Jump through platform - Actor is colliding with side of platform
toastytee
Member Posts: 53
Hi guys,
I'm working on a platformer style game and I'm having trouble with the player jumping through the platform. For reference I'm following T-shirt booths tutorial:
I can get the player to jump through the platform and land on the top. The problem I'm having is that if the player moves off the platform and quickly moves back towards it, it will continue to collide with the side of the platform. This is still happening even with the rules that say:
when PlayerX > SelfPositionX-(SelfSizeWidth)/2)-(PlayerWidth/2)
when PlayerX < SelfPositionX+(SelfSizeWidth)/2)+(PlayerWidth/2)
Collide with player
Comments
Ok guys, its been two years. Still have no solution to this problem?
Sorry for the video quality but here's what I'm talking about:
The logic I have for the platform looks like this:
If PlayerPositionY >= SelfPosition.y+(Self.size.height/2)+16
then collide with player.
What is happening is if you drop off the side of the platform and immediately move back toward it, the player continues to collide with the side of the platform, despite having the rule above.
you dont want the white actor to go through the brown actor?
I want the player to collide with the platform only when hes on top of it, not when hes on the side of it.
Do it like this, 2 separate actors
much easier, less commands
still can't figure it out but i did find a workaround.
If: PlayerPositionY >= SelfPosition.y+(Self.size.height/2)+16, collide with player
otherwise: Spawn actor (platform), destroy self
would still love to know if theres a way to do it without needing to spawn/destroy platforms
It might be a box2d issue , i think its just how the collision manager works in gs i would love to know as well i tried couple of ways but couldnt get it to work
Have you tried checking the "better collisions" box on the physics tab of the actor? Not sure it will help, but it's worth a try.
Mental Donkey Games
Website - Facebook - Twitter
Try checking linear velocity Y . . .
For example if linear velocity Y is > 0
--some rule goes here
Otherwise
--collide with platform
So the player is able to jump up through the platform (a positive Y velocity), whereas on the way back down (a negative Y velocity) or at rest (0 Y velocity) it will collide with the platform.
Rule in ground actor-
If self position y >= player position y - (work out the correct number ie 50)
Do nothing
OTHERWISE
collide with player
Here's a quick example.