How do I keep my patrolling enemy from escaping his bounding

Get help using Construct 2

Post » Wed May 13, 2015 6:59 pm

Trying to do the "simple AI", with a block on each end of a platform that is supposed to send my enemy traveling back and forth between them.

I have the enemy moving left and right, and bouncing off properly. However, when my player character gets close, he is propelling the enemy away, and the enemy will continue through the block that is supposed to contain him on the platform.

I had been playing with Line of Sight, earlier, and am wondering if there is something I may still have in there. But being new to this, I am a bit confused.

Beyond that I have had no issues so far learning Construct 2, so I'm a bit frustrated now.
B
5
S
1
Posts: 5
Reputation: 392

Post » Fri May 15, 2015 12:13 am

You want the enemy to follow the player or just go left and right like gomba in mario games?
If you want the mario style, just add the sine behavior to the enemy.
B
60
S
10
G
10
Posts: 1,013
Reputation: 9,155

Post » Fri May 15, 2015 12:39 am

the easy way to do, is to make the enemy character move automatically, once it hits object (pipe lets say) change the angle of movement opposite ( 0 is right . 180 is left, 270 is up 90 is down) try doing it with bullet behavior and switch set angle from yes to no ,and add platformer behavior so it stays on ground, the platformer behavior of enemy should have controls set on custom, if you leave them on default when u press keys arrows, will move as a normal character you don't want that.

make sure the floor or ground has solid behavior.

when layout starts set angle of motion from bullet behavior of the enemy to 0 so it starts toward right side, then you add the collision detection and change movement direction from bullet behavior of the enemy to 180-self.bullet.directionangle ( that means if enemy has current angle 180 minus 180 from the front will be 0 if the current angle is 0 minus 180 from the front is 180 ) gluck hope it helped you!


i doubt you'd manage to understand so i made a capx for you Download
B
77
S
23
G
69
Posts: 1,353
Reputation: 43,960

Post » Sat May 16, 2015 7:09 am

Thank you, both. I will give both a try, tomorrow. I think that bullet behavior may be the route to go. Thanks again!
B
5
S
1
Posts: 5
Reputation: 392


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 44 guests