car movement follow player?

0 favourites
  • 4 posts
From the Asset Store
Basic Rounded Vector Geometry Player Design with Glow for 3 player games
  • I'm trying to get an enemy ai spacecraft to point towards my player and I think I have it figured out with the exception of the angles. Having a brain cramp. So heres how I think it should be done.

    check to see if player is left of center(enemy) press left

    check to see if player is right of center(enemy) press right.

    So what angles am I checking for in this case with the conditions? Or is there an easier way?

  • If I understand your question correctly, setting angle is easy enough, just use Every tick, AI Set angle towards (Player.X, Player.Y).

    capx

    Is that what you meant, or am I missing something?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There is an action called: Rotate toward position, use it with the (player.X,player.Y) and the spacecraft will rotate at the desiered angle, the initial angle of the spacecraft(at the strat of layout) is 0, and it should be pointed to right (->) like this, otherwise, you will be confused when you'll use the rotate toward pos.

  • GeometriX wildmedia,

    Thanks you two. The problem was I was using the car behavior. Rotating the angle rather then using the simulate movement made it look real choppy. So what I did was check first to see if the angle was withing 2 degrees of the player. If so then it continues forward. If not then I check the is clockwise condition. If its clockwise I simulate right, if its not clockwise I simulate left movement. I still wish there was an easier way though. :( thanks for trying you two. :)

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