Help with platformer
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Help with platformer
So I'm working on some platform collisions, and I have the collision for the top of the platform down, but the way I have it, when my player collides with the side, he just pops back up to the top. I know I had a fix for this a little while back, but I've completely forgotten it :/ can someone offer some insight?
- Attachments
-
- Platform.love
- (1.21 KiB) Downloaded 64 times
Re: Help with platformer
I have no experience in platformer games, but i recommend you to keep your code commented. It makes others lives much easier since they'll know what a specific session does.
I messed a bit with your code. Sometimes pressing D and A often makes your character jump, for some reason.
Printing the value of "player.isFalling" actually shed a light on this. The value keeps bouncing between true and false. I "fixed" this here, but the character wouldn't jump anymore, so, i guess it's back to square zero.
I messed a bit with your code. Sometimes pressing D and A often makes your character jump, for some reason.
Printing the value of "player.isFalling" actually shed a light on this. The value keeps bouncing between true and false. I "fixed" this here, but the character wouldn't jump anymore, so, i guess it's back to square zero.
https://github.com/Sulunia
Re: Help with platformer
yeah I noticed the character would jump when changing directions, which is weird since he should only jump when hitting one of the jump keys.Sulunia wrote:I have no experience in platformer games, but i recommend you to keep your code commented. It makes others lives much easier since they'll know what a specific session does.
I messed a bit with your code. Sometimes pressing D and A often makes your character jump, for some reason.
Printing the value of "player.isFalling" actually shed a light on this. The value keeps bouncing between true and false. I "fixed" this here, but the character wouldn't jump anymore, so, i guess it's back to square zero.
And you're right, I should comment my code,but I barely understand what it does myself
Yeah player.isFalling switches between true and false because I set player to be one pixel above the platform when he touches it, cuz if I didn't he'd sometimes get stuck, it was a temporary fix that seemed to cause more problems
Re: Help with platformer
In that case, make sure isFalling value does not bounce around, and make sure that the character only jumps when the JUMP key is pressed, rather than checking if he's falling to modify his Y speed. I'm not looking into code right now since it's damn late here, but if you keep on having problems i'll help you out tomorrow.
https://github.com/Sulunia
Re: Help with platformer
I managed to fix some stuff, but now when player collides with the left or right of the platform, he cant move left or right, also, if he gets to the edge of the platform, movement gets buggy, i kinda know what causes this(setting xVel = 0) but idk how to fix itSulunia wrote:In that case, make sure isFalling value does not bounce around, and make sure that the character only jumps when the JUMP key is pressed, rather than checking if he's falling to modify his Y speed. I'm not looking into code right now since it's damn late here, but if you keep on having problems i'll help you out tomorrow.
- Attachments
-
- PlatformV2.love
- (1.27 KiB) Downloaded 57 times
Re: Help with platformer
Why not to use Bump?
It will help you to go past the point where you are detecting collisions and move on to deciding what do you want to do with the objects around collisions.
It will help you to go past the point where you are detecting collisions and move on to deciding what do you want to do with the objects around collisions.
Who is online
Users browsing this forum: Google [Bot] and 210 guests