How do I make an enemy to give priority over other events

Get help using Construct 2

Post » Wed Aug 31, 2016 2:12 pm

Hello

I'm trying to make the AI for one of my enemies. Basically is sleeping and whenever the player is on sight starts moving either left or right. Once the player is out of sight goes back to sleep.

Now, if the enemy runs into a wall turns around in the opposite direction so if he's facing away from me and losses sight, whenever I get close, he keeps walking in the opposite direction that was called by the wall event to turn around so it feels like I'm chasing him.

I've been trying for hours different events to make him come towars the player when he wakes up rather that keep going in the direction called by the wall event.

Here's the code:

Image
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Wed Aug 31, 2016 4:42 pm

Because event 35 - 38 are subs under 'is sight', 'it' can only change direction when 'it' sees Player.

On the moment 'it' can't see Player, 'it' keeps moving in the direction that it was allready moving. 'it' just cant change direction.

Bring those events outside the 'is sight'.

Also, the animation changes to 'sleep' when 'it" is not seeing the player. But there is no action that makes 'it' actual sleep', if sleep = also stop moving.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Wed Aug 31, 2016 10:52 pm

99Instances2Go wrote:Because event 35 - 38 are subs under 'is sight', 'it' can only change direction when 'it' sees Player.

On the moment 'it' can't see Player, 'it' keeps moving in the direction that it was allready moving. 'it' just cant change direction.

Bring those events outside the 'is sight'.

Also, the animation changes to 'sleep' when 'it" is not seeing the player. But there is no action that makes 'it' actual sleep', if sleep = also stop moving.


Thanks will test tomorrow.

Btw it does stop moving and goes to sleep
B
14
S
5
Posts: 248
Reputation: 1,705

Post » Thu Sep 01, 2016 12:12 pm

So I tried whay you said and made no difference. The enemy behaves the same way.
B
14
S
5
Posts: 248
Reputation: 1,705


Return to How do I....?

Who is online

Users browsing this forum: Artcadev, brunopalermo, valefor and 25 guests