Turn enemy off when player is within a certain distance for an amount of time

Im not sure if its the Homebrew Cider or just to damn slow to get it tonight but...

I'm working with magnitude to detect a players distance from/to an enemy with no problem but would like to change it up a bit by having the enemy only disappear/die when the player is within say 150pixels of the enemy for 2 seconds before the enemy dies, any shorter and then enemy wont die and the collide with the will kill the player.

Basically I want to avoid the player running full pelt at the enemy and the enemy just disappearing because the player is less than 150 pixels away, I want the player to have to slow down and wait before moving on.

Any thoughts welcome, I feel like its staring me in the face but nothings come through

Comments

  • You could make a character that is wide enough to be 150 pixels around the character, and make its alpha color 0, so it is transparent, and make it so when it overlaps/collides with actor (insert actor here) --> Timer --> after 2 seconds turn (boolean attribute) on, and when the boolean is true, the enemies die. Hope this helped
  • capitalcarnagecapitalcarnage Member Posts: 371
    @agent1692 - thanks for that, was hoping I could do it without a second actor, but I'll use that for the time being. cheers
  • SocksSocks London, UK.Member Posts: 12,822
    @capitalcarnage

    It will be more efficient if the collide actor has it's visibility switched off rather than making it's alpha channel 0.
Sign In or Register to comment.