Why does my gravity code make my character bounce

So I recently put a gravity code from @Hamzah_Alani in my game but it seems to be making my character bounce, plz help

game:First real game1-27-2021_8-11-10.wick (100.3 KB)

(Srry if my code is bad Im a beginner)

You have code changing gravity everywhere. I think that your approach is leading you to too many logical errors. Gravity should be a constant in your game unless your game changes from a planet to another… or for other scenarios, but for the game that you are doing, it should be a constant.

Consider using @awc95014 platformer…

1 Like

Here, i made a fix:
First real game1-27-2021_9-44-05.wick (124.5 KB)

Since you were using that same code i gave you, I noticed that the problem is more likely to be in the repositioning of the objection in relation to the platform. I edited line 25 to fix your file, but you can remove that line since all it does is attempt to make the player on top of the platform.

btw, your project looks really nice

Thanks, Guys! Also @Hamzah_Alani what exactly did you change?

1 Like

I changed line 25 in the player’s update script from:

this.y=wall2.y-((wall2.height/2)+(this.height/2)-1);

To this:

this.y=wall2.y-((wall2.height/2)+(this.height/3));