Navigation

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

    Basic movement-thrust-inertia?

    Beginners
    3
    8
    388
    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.
    • S
      Sgtelite78 last edited by

      in part of my game I want the control to be like the retro asteroids game. I got the rotate left-right working but I am lost on how to do the forward movement, I know it has to do with the rotation direction of the ship and I can read the rotation angle but how to convert that into a movement direction and how to keep moving afterwards. I have read the tutorials and looked at vectoids is that the name? in the programs but that is a different kind of movement and not what I want. how do I do it?

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

        @Sgtelite78 try looking into some of the sample projects or there's a video on movement on the fuze youtube

        1 Reply Last reply Reply Quote 0
        • S
          Sgtelite78 last edited by

          Thanks but like I said I tried the tutorials but their movement is not the same as I wish to use. maybe it can be adapted but I dunno how.

          1 Reply Last reply Reply Quote 0
          • S
            Sgtelite78 last edited by

            Don't need it, working now. used some sin/cos with setspritespeed

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

              Use sin and cos
              Ie
              New_velocity_x = sin ( ship_angle ) * thrust
              New_velocity_y = cos ( ship_angle ) * thrust
              Then add together your
              Velocity_x =velocity_x + new_velocity_x
              Velocity_y =velocity_y +new_velocity_y
              Then add to your position
              X_pos = x_pos + velocity_x
              Y_pos = y_pos + velocity_y
              Also don't let the velocity get to high or you'll zip straight off the screen

              S 1 Reply Last reply Reply Quote 2
              • S
                Sgtelite78 @xevdev last edited by

                @xevdev said in Basic movement-thrust-inertia?:

                Use sin and cos
                Ie
                New_velocity_x = sin ( ship_angle ) * thrust
                New_velocity_y = cos ( ship_angle ) * thrust
                Then add together your
                Velocity_x =velocity_x + new_velocity_x
                Velocity_y =velocity_y +new_velocity_y
                Then add to your position
                X_pos = x_pos + velocity_x
                Y_pos = y_pos + velocity_y
                Also don't let the velocity get to high or you'll zip straight off the screen

                your way is better than mine so I'm using it. it is perfect but one flaw and when I rotate the ship and then press thrust it does not slow down and then move in new direction it jerks-jumps. if not for that it would be arcade perfect!!

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

                  Thrust should be small .
                  I think when I made a similar game I had it accumulate to 10 then divided by 10 so it never got bigger than 1

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

                    Had a look at my code and thrust was 1/10.
                    Here's a video of the code and what it should look like. Max_Thrust = 6 it can be larger

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