How do I keep my patrolling enemy from escaping his bounding

0 favourites
  • 4 posts
From the Asset Store
Fly Bound
$2.49 USD
Design for game, asset for game, game kit, UI design, completed design for game FLY BOUND
  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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

  • Thank you, both. I will give both a try, tomorrow. I think that bullet behavior may be the route to go. Thanks again!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)