Car racing game with gear shifts
-
I've been thinking of making both 2D and 3D racers of a few different styles. Drag Racing, circuit style, point-to-point/sprint style... The 2D games would probably be simpler to make, whether they are top-down or isometric... In the case of drag racing games, the 2D ones would probably be a hybrid of isometric or top down and side scrolling.
-
You could use a variable to keep track of your current gear, then use an if statement when a button is pressed to change the gear level, then stop the car sound channel and reset it to the sound that matches the new gear.
-
Like an RPM variable, for the RPMs of the engine?
-
An RPM variable could be helpful if you want it to switch gears automatically at a certain RPM, or perhaps to check whether to change the gear up or down if you use the same button for manually changing, I think you may also need a separate variable to keep track of the current gear you are in.
-
I would have two buttons for the gears, one for up and the other for down
-
That sounds good, then have a variable for your RPM, and a variable for your current gear, and adjust those variables when pushing the buttons. Then change the sound and anything else that you want to change when changing gears based on the new value of your current gear variable.
-
Perhaps you could have something like this:
c = controls(0) oldc = c currentRPM = 0 currentGear = 1 loop clear() c = controls(0) if c.a then currentRPM += 1 endif if !c.a then currentRPM -= 1 endif if c.up and !oldc.up then currentGear += 1 if currentGear == 2 then stopChannel(0) playAudio(0, carSFX, 1, 0.5, 1, -1) else if currentGear == 3 then stopChannel(0) playAudio(0, carSFX2, 1, 0.5, 1, -1) endif endif endif oldc = c update() repeat
Where the A button is the gas, and the Up button is shift up a gear. You could use different sounds for the car, or change the play speed of the same sound. Then just do this for all of the gears, and do the opposite for shifting down. I hope this helps.
-
I was thinking of having ZR be the gas button and A and B for the gears, but I'm also trying to make other things for my games, like a race track map. I'll try out some of your suggestions though, to see how they work 😉
-
@zeldagamer22 Sorry I think I accidentally rejected one of your posts. Until you have a reputation of 10 (likes) your posts have to be moderated and I clicked the wrong button
-
I have to get a map and car working for my racing games but I'm a bit stuck :(
-
How could I test the gear shifting with an already made game, so I could see how it works and fine tune the shift system? Making a game from scratch is quite difficult for me
-
What are you having trouble with? Also, you can check out the Fuze Arena tutorial videos on Youtube, they are quite helpful.
-
I'm having trouble getting the game started and getting the car and map to show up.
-
Maybe this will be useful:
https://fuzearena.com/forum/topic/1634/car-driving-engine -
I can't download that to look at the code...
-
@zeldagamer22 It seems to have been unshared. I will see if I can get them to share it again