3-lane racing game? need some help.

0 favourites
  • 3 posts
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • 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 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>

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

    This is excellent advise.

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