How do I move an enemy back and forth on a straight line?

0 favourites
  • 3 posts
From the Asset Store
Helping streamers give their viewers more excitement.
  • I was originally using the sine function, but I want to have more control over the NPC. Essentially I'll be setting up horizontal lines or rows across my map and have enemies spawn on different rows. Each row will have a different movement pattern. So I started, exploring the 8 direction with simulate movements. Unfortunately, this behavior isn't working as I expected. I attached the CAPx. Right now I want the 8 direction to move left until it collides with an object and then reverse. Simple enough right? But for whatever reason, it hits the object, bounces a bit the continues left. Anyone know which rookie mistake I have used on this one? Maybe there are other methods of doing this? Thanks!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Reverse just gives a bit of a bounce: (manual):[quote:3j7fz4v7]Invert the direction of motion. Useful as a simple way to bounce the object off an obstacle.

    You need to simulate moving right afterwards.

  • Ah, I needed to set up a variable to turn off the left direction and turn on the right. That makes sense, thanks!

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