3-lane racing game? need some help.

Get help using Construct 2

Post » Sat Apr 27, 2013 4:24 am

Hi guys, so far so great with the community, all my brand newbie questions are being answered without exception.

What I'm trying to do is recreate the old race game style where a side-view road has like 3 lanes and the car moves up and down the lanes to avoid cars. No particular game comes to mind, but I know I played a few like this on my SNES.

Using physics like on http://www.scirra.com/forum/behavior-car-physics_topic52225.html , does anyone know how I might be able to make side-view racing game with a multi-layered street to simulate lanes>
B
4
Posts: 12
Reputation: 324

Post » Sat Apr 27, 2013 9:20 pm

I'd say start with three lanes, and have an instance variable on your car that tracks which lane it should be in. Then you just assign each lane a number and set that lanes number in the instance variable. That way say lane 2 is the middle lane, your instance variable for player.lane would be set to 2. If you hit the right arrow it sets the variable to 3 as that is the next lane you would move to if you went to the right. You then have logic that looks at the number which is now 3, and moves your car over (vectorX) into lane 3. So hitting the right arrow adds 1 to the variable telling it to move you over one lane. The left arrow subtracts 1 from the variable as you want to move to the left. Of course you need to also make sure the variable does not go beyond 3 or less than 1 as you are only going to have 3 lanes.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,418

Post » Wed May 01, 2013 7:04 pm

[QUOTE=BluePhaze] I'd say start with three lanes, and have an instance variable on your car that tracks which lane it should be in. Then you just assign each lane a number and set that lanes number in the instance variable. That way say lane 2 is the middle lane, your instance variable for player.lane would be set to 2. If you hit the right arrow it sets the variable to 3 as that is the next lane you would move to if you went to the right. You then have logic that looks at the number which is now 3, and moves your car over (vectorX) into lane 3. So hitting the right arrow adds 1 to the variable telling it to move you over one lane. The left arrow subtracts 1 from the variable as you want to move to the left. Of course you need to also make sure the variable does not go beyond 3 or less than 1 as you are only going to have 3 lanes.[/QUOTE]
This is excellent advise.
B
4
Posts: 12
Reputation: 324


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 23 guests