How do I make object move towards player?

  • Ok so I have tried this with pathfinding about a bagilion times now, and it doesnt do crap. The only time it worked, was when I put the player right next to the enemy. And then the enemy just flew slowly towards the player.

    I need the enemies to always walk towards the player, and walk on the ground. not fly. its a platform game, not a top down.

    And also im wondering how I make the enemys look towards the player. and only mirrored not upwards. thanks

  • For the ennemy to look towards the player,use in System the "Compare Value"

    Player.X>Ennemy.X -> Ennemy Set Not mirrored

    Player.X<Ennemy.X -> Ennemy Set mirrored

    To make him walk, give to it the "Platform" behavior and disable default controls. Use the same events as above, but change the actions.

    Player.X>Ennemy.X -> Ennemy Simulate Control Right

    Player.X<Ennemy.X -> Ennemy Simulate Control Left

    Hope this helps!

  • Ok so I did what you said, and still it doesnt move or mirror at all! I have a picture so you can see if I did anything wrong! (note: the enemy is named AI)

  • EskilPotet

    Those should be 4 different events, not one!

  • oh yeah! it works now! thanks! but do you know how I can make it jump if there is an object in the way?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can add an invisible sprite to the obstacle (slightly wider than the obstacle).

    On Enemy collision with that sprite -> Enemy simulate jump.

  • thank! You're the best!

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