Navigation

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

    2d skateboard game

    Beginners
    18
    149
    26623
    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.
    • Spacemario
      Spacemario F @waldron last edited by

      @waldron Hah, funny coincidence-- I've been working the past couple of weeks on a 2d, overhead rollerblading game! It'll be fun to compare what we come up with if you pursue the idea further :)

      In my "engine", I have the player alternating "ZL" and "ZR" to do the thrusting forward. I can explain how I did it, is that what your question is?

      waldron 1 Reply Last reply Reply Quote 1
      • waldron
        waldron F @Spacemario last edited by

        @Spacemario yeah that's what I'm looking for,
        Been working on this game for a while now and pretty much my main focus.
        Thinking of keeping my current setup of controls but adding the zr for thrust il upload a vid soon

        Spacemario 1 Reply Last reply Reply Quote 0
        • Spacemario
          Spacemario F @waldron last edited by

          @waldron Gotcha'! The kids are with grandma today, so I'm going to see how far I can get-- then I can just share my whole project, and you can copy out what you need! My "engine" is done, all I need to do is draw some more tiles, and put together a nice demo map.

          But the gist of it is like this: I have a variable declared on the player sprite indicating which foot the player needs to use next, and which is initially set to "either". Then when I grab their input, I just toggle that variable from "left" to "right".

          player.nextFoot = "either"
          
          ...
          
          if shouldReadInput and joy.zl and !joy.zr and (player.nextFoot == "left" or "player.nextFoot == "either") then
              player.speed += 1.5
              player.nextFoot = "right"
              resetInput() // This is for my input filtering, as is "shouldReadInput"
          endif
          
          if shouldReadInput and joy.zr and !joy.zl and (player.nextFoot == "right" or "player.nextFoot == "either") then
              player.speed += 1.5
              player.nextFoot = "left"
              resetInput()
          endif
          
          // If they are going slow, let them push with either foot
          if player.speed < .25 then
              player.nextFoot = "either"
          endif
          

          You could also make "player.nextFoot" "strongly-typed" by making enum-style variables, instead of using a magic string like me.

          Then I handle the player rotation in a speed-dependent way, like this:

          if joy.lx != 0 then
              if player.speed == 0 then
                  player.rotation += joy.lx * 2
              else
                  player.rotation += (joy.lx * player.speed) / 1.25
              endf
          endif
          

          The actual sprite drawing happens later on in the frame, like this:

          setSpriteSpeed(player, {sin(player.rotation), -cos(player.rotation)} * player.speed * 100)
          

          I also have lots of code to handle crashing, playing music/sfx, animation, moving the camera around to follow the player, and so forth. Once I share the whole thing, it'll make a lot more sense-- but hopefully this can at least get you going.

          I don't know if you're going for a "Tony Hawk's Pro Skater"-style game, but it'd be awesome if you figured out a way to let the player "grind" on objects, like rails or steps!

          waldron 1 Reply Last reply Reply Quote 1
          • waldron
            waldron F @Spacemario last edited by pianofire

            @Spacemario thanks hopefully I can implement some of these controls, this one is in 2d as it's my very first project so I'm learning code as I go so dont want to deal with the complexity of a Tony hawk game (just yet) still in its early stages but getting there.!

            pianofire Spacemario 2 Replies Last reply Reply Quote 10
            • waldron
              waldron F last edited by

              Yeah grinding I'm wanting to just need to figure out how I can do it ! also being able the move up and down like a Simpsons game

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

                @waldron Fixed the link for you. Looks great!

                1 Reply Last reply Reply Quote 2
                • Jonboy
                  Jonboy Fuze Team last edited by

                  What! - i did not see that coming. This is awesome! Are you planning adding points for tricks while jumping and the like?
                  Great work on the graphics too!

                  waldron 1 Reply Last reply Reply Quote 1
                  • waldron
                    waldron F @Jonboy last edited by

                    @Jonboy Thank you, yes and lots more tricks but its my first time coding so lots to figure out.
                    working on getting motion so the skater rolls with out stopping atm
                    then a point system.

                    1 Reply Last reply Reply Quote 2
                    • Jonboy
                      Jonboy Fuze Team last edited by

                      sorry dude but i have to call you out on that statement... There is no way, no chance whatsoever, that this is your first time coding. Come on be honest, you are not a total noob now are you?

                      If, and that's a slim chance indeed, it is your actual first time, then you are one to watch.

                      I for one will be watching very closely on how this develops.

                      Good luck sir.

                      waldron 1 Reply Last reply Reply Quote 3
                      • waldron
                        waldron F @Jonboy last edited by

                        @Jonboy Your making me go red, i think its down to the fuze 4 platform
                        with its tutorials and the fuze arena site with a brilliant!!! community.
                        Without this and you guys id be lost in a matrix of numbers and letters
                        Honestly thank you because believe me i could not do this on my own.

                        1 Reply Last reply Reply Quote 3
                        • waldron
                          waldron F last edited by

                          really need to get this motion sorted feel like its gonna be the hook i need to make it a fun and challenging game
                          iv messed with the c.right and c.left adding allsorts to get my player to (roll) move and slowly slow down on its own
                          with no joy any help would be greatly appreciated.

                          Tratax 1 Reply Last reply Reply Quote 0
                          • Tratax
                            Tratax F @waldron last edited by Tratax

                            @waldron hey, happy to have a look and give some suggestions if you'd like to share your friend-code and game?

                            And just to confirm, you're looking to build in acceleration/deceleration and some Y axis movement?

                            Awesome progress btw!

                            waldron 1 Reply Last reply Reply Quote 2
                            • waldron
                              waldron F @Tratax last edited by

                              @Tratax sweet iv shared it, my code is Waldron 6256-2637-1602

                              waldron 1 Reply Last reply Reply Quote 1
                              • waldron
                                waldron F @waldron last edited by

                                @waldron said in 2d skateboard game:

                                @Tratax sweet iv shared it, my code is Waldron 6256-2637-1602

                                cheers yeah, acceleration/deceleration and some Y axis movement would be perfect

                                Tratax 1 Reply Last reply Reply Quote 0
                                • Zero Division
                                  Zero Division last edited by

                                  @waldron You're cooking with gas, my friend. Skateboard game looks awesome!

                                  1 Reply Last reply Reply Quote 3
                                  • Spacemario
                                    Spacemario F @waldron last edited by

                                    @waldron Whoa, you really nailed that animation, it's fantastic! Stylistically, it reminds me of an even better "Skate or Die" on the NES.

                                    1 Reply Last reply Reply Quote 3
                                    • Tratax
                                      Tratax F @waldron last edited by Tratax

                                      @waldron hey - have updated the code and favourited the edits with some suggestions, re-shared this if you want to take a look.

                                      The way i think of it is the skateboard always running in a state of movement, initiliasing the movement speed lower and utilising an "acceleration" variable as a multiplier in small increments that increases to a max or decreases to a negative max depending on how fast you want to go only when the buttons are held

                                      The else condition highlighted then exists for the purpose if nothing is presssed to reduce that acceleration variable until it reaches 0 - may need to be split out as I didnt try this with left movement you could use your c. left and right to count up or down on that multiplier possibly

                                      waldron 1 Reply Last reply Reply Quote 2
                                      • Tratax
                                        Tratax F last edited by

                                        Also, it's got a great feeling, keen to see how this progresses!

                                        waldron 1 Reply Last reply Reply Quote 2
                                        • waldron
                                          waldron F @Tratax last edited by

                                          @Tratax legend thank you il have a gander now cheers man

                                          Tratax 1 Reply Last reply Reply Quote 1
                                          • Tratax
                                            Tratax F @waldron last edited by

                                            @waldron All good! worth noting the camera movement speed also has the acc multiplier attached so that it can correctly match the speed of your skater

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