Vector towards player. How to?

This forum is currently in read-only mode.
From the Asset Store
Players follower. use it for anything which follows the player
  • Hi, it's me again. Seems I'm here every 5 minutes with a question

    I'm making a simple Robotron clone. Doing a lot of these easy projects (?) to get to grips with Construct. Atm I've got the enemy sprites checking their X and Y towards the player sprite X and Y. If it's more, decrease. If it's less, increase. This works OK so the enemy are moving towards the player but it ends up with the enemy sprites all lined up in a row if you move around enough. Hard to explain really but suffice to say it's crap.

    So my question is, is there something in Construct that will allow me to vector the enemies towards the player sprite, rather than just inc X and dex Y etc?

    Any help appreciated as always.

    Ta very glad.

  • You can always change their angle towards the player - either right away or in increments.

    Or you can use the Custom Movement behavior - it has a "Move toward" event.

  • It would help if we knew the method you're using to move your enemies. Perhaps you could post a .cap?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I've managed to work it out.

    Before I was just setting the X and Y of the enemies based on the current player position. If the players X was higher than the enemy, increase the enemy X ... etc. It worked but was very rigid and not what I was after.

    To fix it, I set the enemies up as bullets. Then set their angle towards the player and BOOM, they all move towards the player in a nice smooth arc. Don't know if this is ideal but it looks and works the best way I've tried.

    Thanks for the help

  • As long as it looks and plays nicely for the player.

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