Enemy jump towards player...

0 favourites
  • 3 posts
From the Asset Store
Be discreet and rescue your friends from behind enemy lines.
  • So the level 1 Hero is strolling through the grassy hills of the first part of the world. HE SPOTS A SLIME! Buuuuuut it's just bouncing up and down because the deity orchestrating the events doesn't know how to make it jump to the left or right depending on which side the player is on.

    How do I make the slime jump to the left if the player is to the left of it, and to the right if the player is to the right of it?

  • As usual, there are many ways to do this.

    I think one of the easiest ways is to put a Platform behavior on your enemy, but turn the default controls off. Then when an event occurs you can simulate jump, left and right controls. If the player gets within a certain distance of the slime, simulate right if player.x is greater than slime.x and left control if player.x < slime.x. Here is an example (created with release 93):

    Slimed.capx

    If you haven't checked out JohnnySix's patrolling example in the arcade, you should. Very cool example, and you can download the capx to see how he did it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks :)

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