Line of Sight Used As An Enemies Weapon

0 favourites
  • 11 posts
From the Asset Store
Futuristics Weapons Vol 1 includes 8 different weapons, in a total of 216 sounds
  • Hey guys.

    I'm attempting my first game, which is basically a stealth and avoidance game based around the excellent "Pathfinding with line of sight" tutorial.

    A game mechanic I'm trying to add is that after an enemy has has a line of sight with the player for 4 seconds, a player death occurs (it being the main way you can die besides from the enemy touching you).

    This is what I (in my noob state) have programmed up, but I'm stuck as to what I have to do to 'reset' the enemies playstate after you escape (within four seconds):

    The idea being that once the line of sight has been broken if it's before the 4 seconds are up, the player can then go on his merry way. But of course even if the line of sight is broken, the four seconds before the Player destroy still counts down regardless.

    Any help would be quite appreciated. Cheers.

  • Add a timer behavior to the player and start the timer when enemy has line of sight. Remove the System Wait.

  • Hey Sponghammer, thanks for your prompt reply.

    Unfortunately that didn't work for me, because now as soon as the enemy initiates line of sight, the player dies. I feel there is something big I'm very obviously missing here lol

  • You have to remove the Player destroy.

    Make a separate event to deal with the timer. Enemy "on timer" Enemy Destroy.

    That'll do it

  • It's just not working for me, I may need to do some more tutorials to get my head around it all.

    When you say "Enemy "on timer" Enemy Destroy", do you mean that the timer behaviour should in fact originate from the enemy and not the player?

    So far my logic goes like this:

    Enemy has line of sight? Yes? Then start Timer "playerDeath" for four seconds.

    Enemy has line of sight? No? Then stop Timer "playerDeath".

    Enemy, on Timer "playerDeath" elapsed? Player > Destroy

    The game is actually doing the opposite to what I want it to do. If you loose line of sight for 4 seconds, you die. However, if you maintain constant line of sight, then you don't die!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Here, try this

    https://dl.dropboxusercontent.com/u/1685424/death_by_timer.capx

    edit: Thats better.

  • Good example. so cute ^^

  • Thank you so much for that example!

    My problem came down to not using Trigger Once and Else

    I'm now slightly less of a Noob! Thanks again.

  • BRIK more tutorial you want try this link

    https://www.dropbox.com/sh/eioscti86bpr ... 7YPza?dl=0

  • Thanks Lord Shiva

  • BRIK most welcome

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)