Collisions for platforms

Idk if this is the right topic for this, but
I need help with platforming collisions
This is mainly targeting @Crosbyman64 because you’re really good at platformers, and our collab (a secert) needs help with this. Feel free to recategorize this to your will. Any help is appreciated. Thanks!

5 Likes

#debug-my-code is the right category for that. good luck!! platformers are a lil tricky, i myself am having difficulties hahah

6 Likes

Ok thanks I didn’t know if this would be debug my code or not :sweat_smile:

4 Likes

Ok idk if this is right, but usually to stop the yspeed, you have it stop when (player) position is the same as (platforms) y pos + (({player} width + {platform} width) divided by 2)

5 Likes

Lol funny you should make this im working on the collisions for our collab right now

5 Likes

Heh lol I was just working on that like 5 mins ago lol

4 Likes

Ngl I should’ve tagged @/CodeHelp but I see @/Crosbyman64 typing lol

4 Likes

Platformer Physics have become much more difficult ever since Player 2.0.x was introduced. It’s still possible, just ask Tri-Angle, but since the way containers behave have been changed, it is harder to make frame perfect collisions, which are required in this scenario.

If you can, I recommend opening your draft (located under Hopscotch > json_projects, sort by date) in
the Project Builder and changing the Player Version to 1.5.27, which will make it a lot easier (disclaimer: the Save HS Project Shortcut is required to save, and you must enable JavaScript under the Advanced Safari Settings (in Settings App) and Allow Running of Scripts under Shortcut Settings for all this to work.

If you are unable to do the above, here’s a template to help get you started:

Local Collisions are much like the traditional Global Collisions, except you are able to add clones (of entities), each with their own set of collisions and movements.

7 Likes

*tile y position + ((tile height + self height) ÷ 2) will set the player flush with the top of a platform.

Let me know if you come across another problem…

7 Likes

why?

8 Likes

Because player 2.0.x broke collisions, and the player just kept clipping through the ground, even though the code was made exactly the right way. It’s also why a lot of users (well, Spy_Guy_96 and me) still use the old 1.5.x version to make platformers.

7 Likes

But why are frame perfect collisions required in this scenario?

7 Likes

Because it always seems to not work correctly when they’re not perfect :man_shrugging:

I know you have your own collision code, but I’m not sure if it’ll work in this scenario… or am I thinking of someone else?

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.