Hopefully this is Easy!

Get help using Construct 2

Post » Wed May 25, 2016 11:44 pm

Hello there,

So I'm making a sneak game so I was wondering if I could add a sound implement? What I mean is, is that if the player (you) doesn't "sneak" within a certain vicinity then the enemy will immediately snap to the player and look for them! Any tips?

Thanks in regard,
Chris
B
15
S
5
G
2
Posts: 31
Reputation: 2,002

Post » Thu May 26, 2016 12:59 am

If your game is top down and the enemy object has "pathfinding" behavior


1- compare player distance to enemy distance ... Add event - System - compare two values - first value is dhe minimal distance the player can move close to the enemy without being detected ( you decide that) is smaller "<" than the second value , which is (player.x,player.y,enemy.x,enemy.y)
2- on the same event ad another condition - if player is not sneaking ... i would use a local variable for the player , sneakint=1 or sneaking=0
If player is not sneaking , so sneaking=0 than this second condition is true .
3- add action - enemy - find path to (player.x,player.y)
4 - new event - enemy - if path found - fallow path ...


In case your game is a sidescroller with gravity , i think you will find a way for the enemy to go to the player
'Image'Image'Image
B
18
S
5
G
2
Posts: 90
Reputation: 2,335

Post » Thu May 26, 2016 7:57 pm

B
70
S
20
G
67
Posts: 1,314
Reputation: 42,301

Post » Fri May 27, 2016 2:48 am

Thanks everyone for the replies! Figured out what I wanted!
B
15
S
5
G
2
Posts: 31
Reputation: 2,002


Return to How do I....?

Who is online

Users browsing this forum: Mayfly and 8 guests