Line of Sight Used As An Enemies Weapon

Get help using Construct 2

Post » Sun May 31, 2015 3:00 pm

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):

Image

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.
B
3
Posts: 5
Reputation: 185

Post » Sun May 31, 2015 3:41 pm

Add a timer behavior to the player and start the timer when enemy has line of sight. Remove the System Wait.
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Sun May 31, 2015 4:07 pm

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

Image
B
3
Posts: 5
Reputation: 185

Post » Sun May 31, 2015 9:33 pm

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 :)
B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Mon Jun 01, 2015 2:57 am

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

Image

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! :lol:
B
3
Posts: 5
Reputation: 185

Post » Mon Jun 01, 2015 7:52 am

B
48
S
16
G
9
Posts: 1,098
Reputation: 11,197

Post » Mon Jun 01, 2015 11:41 am

Good example. so cute ^^
Image Image
B
25
S
14
G
137
Posts: 876
Reputation: 71,505

Post » Mon Jun 01, 2015 11:47 am

Thank you so much for that example!
My problem came down to not using Trigger Once and Else :D

I'm now slightly less of a Noob! Thanks again.
B
3
Posts: 5
Reputation: 185


Post » Tue Jun 02, 2015 1:52 pm

Thanks Lord Shiva :D
B
3
Posts: 5
Reputation: 185

Next

Return to How do I....?

Who is online

Users browsing this forum: 25games, jatin1726, Resslx and 43 guests