How do I make a simple Platformer?
I am still new here, and I am having a very hard time with making a Platformer and I don't get it, especially when I try the physics of it, is there someone who can help give me an example of something, having a such a hard time.
What have you tried so far?
About everything, I am struggling with most of it
Uhhh Tiberius what to do mean? And arhodes I have a hard time with the physics, I don't know how to code that high level yet, and I have did about everything else.
Oops sorry I meant that I struggled with making my Platformers, but now I have made so many, if you want to check mine out you can see them, hope you're making a good game, you got it other Tiberius 😏🔥
I recommend working through the tutorial "Create a game". It features a jumping character, and will show you how to do at least part of what you want.
First, you need three variables for your player to simulate gravity: the player's y position, the player's velocity along the y axis, and the acceleration at which the velocity changes. Every frame, the player's y position is changed by adding the velocity, and the velocity is changed by adding the acceleration. The acceleration value is constant and doesn't change. If you set things up this way, your player will fall (or float, depending on whether the velocity is positive or negative) a little further and faster every frame.
Second, you need to handle collisions between the player and platforms. You can do this by setting the player's y velocity to zero when they overlap, just be sure to do it before the spot in your code where you add the velocity to the y position. You can make sure the player is falling and not jumping by checking the sign of it's y velocity value. This prevents the player from getting stuck on the bottom of platforms when they jump up and instead only stop falling when they "land" on the platforms from the top.
Again, the tutorial is the right place to start. MicroStudio's coordinate system makes this a little more complicated than other frameworks, but this should get you started. At the very least you can try to read through other people's code by browsing the "explore" tab and find where and how they implemented these two things in their platformers.
The complete code listing for the tutorial is here: https://microstudio.dev/i/gilles/skaterun/
Thanks man you give me a idea! I appreciate it arhodes.