Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Car racing game with gear shifts

    General Discussion
    4
    18
    583
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Z
      ZeldaGamer22 last edited by

      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.

      1 Reply Last reply Reply Quote 0
      • Dinocoder
        Dinocoder last edited by

        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.

        1 Reply Last reply Reply Quote 0
        • Z
          ZeldaGamer22 last edited by

          Like an RPM variable, for the RPMs of the engine?

          1 Reply Last reply Reply Quote 0
          • Dinocoder
            Dinocoder last edited by

            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.

            1 Reply Last reply Reply Quote 0
            • Z
              ZeldaGamer22 last edited by

              I would have two buttons for the gears, one for up and the other for down

              1 Reply Last reply Reply Quote 0
              • Dinocoder
                Dinocoder last edited by

                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.

                1 Reply Last reply Reply Quote 0
                • Dinocoder
                  Dinocoder last edited by pianofire

                  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.

                  1 Reply Last reply Reply Quote 0
                  • Z
                    ZeldaGamer22 last edited by

                    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 😉

                    pianofire 1 Reply Last reply Reply Quote 2
                    • pianofire
                      pianofire Fuze Team @ZeldaGamer22 last edited by

                      @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

                      1 Reply Last reply Reply Quote 0
                      • Z
                        ZeldaGamer22 last edited by

                        I have to get a map and car working for my racing games but I'm a bit stuck :(

                        1 Reply Last reply Reply Quote 0
                        • Z
                          ZeldaGamer22 last edited by

                          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

                          1 Reply Last reply Reply Quote 0
                          • Dinocoder
                            Dinocoder last edited by Dinocoder

                            What are you having trouble with? Also, you can check out the Fuze Arena tutorial videos on Youtube, they are quite helpful.

                            1 Reply Last reply Reply Quote 0
                            • Z
                              ZeldaGamer22 last edited by

                              I'm having trouble getting the game started and getting the car and map to show up.

                              1 Reply Last reply Reply Quote 0
                              • vinicity
                                vinicity F last edited by

                                Maybe this will be useful:
                                https://fuzearena.com/forum/topic/1634/car-driving-engine

                                1 Reply Last reply Reply Quote 0
                                • Z
                                  ZeldaGamer22 last edited by

                                  I can't download that to look at the code...

                                  pianofire 1 Reply Last reply Reply Quote 0
                                  • pianofire
                                    pianofire Fuze Team @ZeldaGamer22 last edited by

                                    @zeldagamer22 It seems to have been unshared. I will see if I can get them to share it again

                                    1 Reply Last reply Reply Quote 0
                                    • First post
                                      Last post