0 Favourites

which behaviour do i use to make the sprite move on its own

  • Hi

    I am making a racing game.

    I have a car sprite which the user controls to move. But i want to create another car that will move automatically following and attack the car controlled by the user.

    I have tried the turret behaviour but i dont think i have used it correctly as it doesn't do anything. I have used the bullet and that makes the enemy car speed off the layout.

    Can someone please help what code do i need? Please dont ask me to make a platform game as i have to do the racing game for school.

    Thank you for reading

  • You could look at using the Pathfinding behaviour - manual tutorial

    Or give the other car the Car movement behaviour and simulate control with events, although it might be slightly tricky to get it to follow the road or the player car.

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You could use the pathfinding behaviour, but don't forget to add some decision making to the enemy car, vary it's speed, etc. Otherwise it will just move constantly following a path: boring!

  • thank you guys i will try it.

  • I had something similar in a space game I wrote last year ( ). I need the ships to follow and attack the player ship, though not necessarily directly on top of it. It turned out to be very simple, what I did was have the ships constantly move towards a point near the player ship (adjusted slightly on both axes by a random number, e.g -100, -100 so they move to a point above/left of the ship). Then they just constantly move towards that point, by changing their angle to the correct angle (and you can use bullet behaviour to keep the car moving). Every 5 seconds or so, change the random point that they're heading for, to make them bob about to different positions (makes them look as if they're trying manouvers etc).

  • I had something similar in a space game I wrote last year ( ). I need the ships to follow and attack the player ship, though not necessarily directly on top of it. It turned out to be very simple, what I did was have the ships constantly move towards a point near the player ship (adjusted slightly on both axes by a random number, e.g -100, -100 so they move to a point above/left of the ship). Then they just constantly move towards that point, by changing their angle to the correct angle (and you can use bullet behaviour to keep the car moving). Every 5 seconds or so, change the random point that they're heading for, to make them bob about to different positions (makes them look as if they're trying manouvers etc).

    Mind providing a .capx with that behaviour please ?

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