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

Get help using Construct 2

Post » Wed Jul 02, 2014 12:56 pm

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
B
3
Posts: 6
Reputation: 187

Post » Wed Jul 02, 2014 2:32 pm

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.
Vote for all the Construct 2 games on Steam Greenlight - Find them here
B
33
S
9
G
7
Posts: 450
Reputation: 6,780

Post » Wed Jul 02, 2014 9:21 pm

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! :)
Bruno

I like to eat, but I'm no cook. Why liking to play games would make you a game designer?
B
16
S
4
G
1
Posts: 435
Reputation: 2,353

Post » Thu Jul 03, 2014 11:01 am

thank you guys i will try it.
B
3
Posts: 6
Reputation: 187

Post » Thu Jul 03, 2014 12:04 pm

I had something similar in a space game I wrote last year ( http://korelos.clay.io/ ). 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).
B
25
S
5
G
3
Posts: 446
Reputation: 5,633

Post » Sun Jul 13, 2014 3:36 pm

farflamex wrote:I had something similar in a space game I wrote last year ( http://korelos.clay.io/ ). 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 ? :oops:
Black Bobby The Hole Greenlit with 303 votes.
B
36
S
8
G
1
Posts: 163
Reputation: 3,029


Return to How do I....?

Who is online

Users browsing this forum: JDebstup and 11 guests