I need help with my platformer game

I know @Spy_Guy_96 has experience with platformers so it would be a big help if he helps me.

Project link: Advanced Platformer Test by BobbyS123.

Every time the rounded square touches an object it starts going up.

I want my code to make it when it touches an object it collides with the object.

Thank you to whoever helps me.


A lot of advanced platformers, including Spy Guy’s platformers, are all variable driven. It uses NextX and NextY variables to calculate the player’s next position, which is used to prevent a glitch where the player visibly gets bumped out slightly.

Then there’s SpeedX and SpeedY, which controls the movement speed of the player in units per tick (it is very important to set the player’s position BEFORE setting the speeds)

Here’s a template to help you get started. Please be sure to give Spy Guy 96 credit if you use it

Player Version: 1.5.x (RECOMMENDED. Player 2.x.x cannot correctly handle platformer physics and collisions due to the variables in container bug (which may actually be unfixable due to the change in how containers are ran)

You can simply remix an old project to use an older player version. Please note that some blocks will not work as you intended it to (parameters in custom methods, set background, etc.)


Oh thank you


@BobbyS123 did crosbyman answer your question, or are you still wanting more help?

…on another note, welcome to the forum :)


Thank you and he showed me an example of @Spy_Guy_96 platformers.


I still don’t get it how to make collisions. I do know you have to use variables.


Hey! Welcome to the Forum, I have a video somewhere keep your eyes peeled

1 Like

Ok thank you.

1 Like

I just didn’t want it when you touch an object you go up.


Hey Bobby!

The character goes up to the top of that object because you let the object be touched by the cube.

I know but i dont want it when you’re below the object and you jump and you don’t make it but you start going up.


But thanks for helping me!


No problem :slight_smile:
Logging off, cya

When is touching runs when an object touches an object from any side, and currently, you don’t have any code to force the square out of the sides of the platforms (they all force the square to unintentionally move up).

Basic rectangular collisions work similar to when is touching, but is much faster and can anticipate a collision early.

abs(player x - self x) < (((player width + self width) / 2) - 1) //checks for current X collision
abs(player y - self y) < (((player height + self height) / 2) - 1) //checks for current Y collision

  • These two (above) are used together only for hazard / goal based collisions

abs(NX - self x) < ((player width + self width) / 2) //checks for Next X collision
abs(NY - self y) < ((player height + self height) / 2) //checks for Next Y collision

  • these two are used with the other two above (NX is used with player y, and NY is used with player x)
  • The Next X (NX) collision check is to check collision in the X direction
  • The Next Y (NY) collision check is to check collision in the Y direction

((player width + self width) / 2) = half of sum of the two objects. This places the player exactly to the edge of the platform when adding to its current position.

abs(player x - self x) = distance between the player and platform in the x direction

When a player’s position is corrected, its speed in the current direction is reset to 0 (to prevent the player from moving any more)

Next X and Next Y is the next anticipated position of the player

Sorry, I cannot make the explanation any simpler. Platformer based collision is extremely difficult to understand if you are not experienced with making them.


If it’s too confusing, maybe use petrichor’s platformer collisions, they’re a lot more simple and basic

1 Like

But how well would it work for gravity based collisions?

1 Like

It sorta works… but the square size is unchanged

Omg thank you.