0
\$\begingroup\$

I'm writing a platformer lode-runner-like game. I would like to ask experienced people to see what's wrong. Everything seems to be ok but I am absolutely confused about 3 bugs.

  1. Why is the player jumping on top of the ladder?

  2. I tried to put the physics of the player's sprite body to -gameSettings.gravity.v to prevent a slow slide down the stairs but after that when the player rises to the top he cannot get off the ladder.

  3. When you collect all the boxes, a ladder appears on the uppermost platform. It is no different from other ladder, but sometimes I can climb on it and sometimes I can't.

I know that I ask too many questions, but I am sure they are all related to physics error I made somewhere in my code.

https://platformergametest.000webhostapp.com/ here I uploaded my game on free hosting

\$\endgroup\$
0
\$\begingroup\$

First: Try to add some code to your question so we can know what may be wrong more easily.

From what I could see, just by laying it, I can answer your questions very vaguely (most you have already noticed by yourself):

  1. Why is the player jumping on top of the ladder?

It's because of the gravity. I noticed that if you release the 'up' key, the player falls slowly, as if it's being pulled by gravity, when you are on top of the stairs, you can still fall from there, then if you keep pushing 'up' it will momentarily leave the stairs, but then gravity pulls you back down and this becomes a cycle, giving the illusion of "small jumps".

  1. I tried to put the physics of the player's sprite body to -gameSettings.gravity.v to prevent a slow slide down the stairs but after that when the player rises to the top he cannot get off the ladder.

Probably because the top most part of the ladder is not perfectly aligned with the ground

  1. When you collect all the boxes, a ladder appears on the uppermost platform. It is no different from other ladder, but sometimes I can climb on it and sometimes I can't.

Probably because the down most part of the ladder is not perfectly aligned with the ground when the stair spawns, maybe the way you wrote your physics behaviour is affecting the placement.

Could you provide some code that can be analyzed?

\$\endgroup\$
3
  • 1
    \$\begingroup\$ I apologize, I did not know which part of the code to post, so I gave a link to the resource where the game is located, there are only a couple of Java script files (you can open it with the developer tools) I forgot to say that I use Tiled as the map editor and save the maps in json format. Themap is essentially a 16x16 grid of tiles (several layers: ground, ladders, background) \$\endgroup\$ – Madcap Jul 9 '19 at 23:12
  • 1
    \$\begingroup\$ github.com/sgt-madcap/loderunnerjs I uploaded it on github \$\endgroup\$ – Madcap Jul 11 '19 at 18:44
  • \$\begingroup\$ I will take a look at it asap! \$\endgroup\$ – Diego Penha Jul 11 '19 at 18:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.