Collision detection in hopscotch


i’m working on geometry dash in hopscotch.
the problem is, 75% of the time, collisions don’t work.

what’s supposed to happen is that if the player hits the block and it’s not on top, the player dies.
otherwise, the player stays on the cube.
i’ve seen bugs like cubes not killing player, and even the player even sinking down into the blocks.
also, if you want to help but don’t have the subscription, you can delete images by holding down an image from the object select menu and then tapping delete.


I have a similar problem where the characters don’t detect that they have hit each other most of the time so I had to give up on the project because it would have been impossible to make it work with the bug. I don’t have the subscription but it’s happing to my text sprites. Hope someone finds a solution on this topic!


Please don’t report these bugs
This was detoured about 6 months ago
@DMF made this detour topic and it’s really useful



Collisions have never worked perfectly, I don’t know if they ever will


i am using DMF’s collision method. i just need help so that the player won’t sink into the blocks, and also crashing into blocks works properly.


Hi @claw33

Let’s move this to Debug My Code. And maybe make the original post clearer that that problem isn’t with Hopscotch collision rules (Bump or Touch) but rather with the project’s code for collision detection. I looked at the code and noticed that, but you’ll be more likely to get assistance by clarifying the problem.


the problem is that collisions are not working.
when the player is close to the block but not on top:
reset level

when player is close to block and is on top:
stop the player from falling

this doesn’t work.
try running into the blocks at the beginning, won’t work.


I’ll have a look to see if I can find the problem but it probably won’t be immediately. In the mean time, maybe someone else will have some suggestions…


Absolutely no idea how, but changing self.y to self.y position(the default one) in where it gets the y distance between it and the cube seems to work


nope, still won’t work.


the player is behind the blocks, that’s the problem i’m having



It worked for me


The player goes behind the block because of the logic circled below.

When the player is on the ground: 100 > 100 - 10 so it doesn’t set Done=2


it only fixes half of the problem. but thanks!


Yeah, it looks like that keeps happening


True. You need different logic to distinguish between front & top side collisions.

Knowing where the problem lies, I thought you might like to find your own solution. I’m sure there’s multiple methods. Feel free to tag me later on if you try but aren’t able to work out a solution.


i think i found a solution?
if the player’s y position is smaller than the block’s y position + 76, it will push the player up.
not the best method, but it kinda helps.


i have no idea.
pushing the player up kinda helps, but it has tons more problems.


Woah are you making geometry dash? You should see geometryscotch by valgo


that makes the player die randomly