having trouble with enemy ai - patrool wait patrool

Get help using Construct 2

Post » Fri May 20, 2016 1:20 pm

Basically I want my ai to walk to the right, hit a colision with a stop object and walk left, rinse and repeat.
BUT before turning, I want it to wait fox X seconds without moving.

patrool state: walk in the direction that you are facing (check if mirrored) , if hit object -->wait state

wait state: wait for 1-2 seconds without moving, turn around , then go back to patrool state

It however does one of the two:
the object does not go to wait state
or
the object goes right through the colision and doesnt even go to wait state.

can someone please share a working example. Nobody on youtube has made one where the enemy stops, then waks in the opposite direction
B
40
S
15
G
4
Posts: 426
Reputation: 5,843

Post » Fri May 20, 2016 1:44 pm

Done just run the capx and watch

http://www110.zippyshare.com/v/Za2f5U2X/file.html

The enemy will move to other side, wait 3 seconds and then come back!!
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613

Post » Fri May 20, 2016 2:02 pm

ah thank you. I solved it this way: the trick was to edit the colision box, so when the enemy turns it stops to overlap the other object
B
40
S
15
G
4
Posts: 426
Reputation: 5,843

Post » Fri May 20, 2016 2:11 pm

btw in your example the enemy does not turn around after waiting
B
40
S
15
G
4
Posts: 426
Reputation: 5,843

Post » Fri May 20, 2016 2:24 pm

Ok now I have a new problem - when one enemy hits a collision, it affects all the enemies that did not hit it! When I refer to the enemy as the enemies family.
Enemies: enemyA-instance1,enemyA-instance2
B
40
S
15
G
4
Posts: 426
Reputation: 5,843

Post » Fri May 20, 2016 8:16 pm

@blurymind

1) The enemy did not turn because its a circle LOL. All you have to do is set the animation in your game to turn or mirror.

Here is an updated version with 2 enemies doing it in the proper order.

http://www28.zippyshare.com/v/hWQHNdV0/file.html
Check out my awesome Android Game releases https://play.google.com/store/apps/deve ... ames&hl=en
B
38
S
18
G
24
Posts: 681
Reputation: 16,613


Return to How do I....?

Who is online

Users browsing this forum: evillair, marcinkowski, unicornspitfire, zenox98 and 11 guests