I'm trying to make a reusable platform game engine in the style of Super Mario Bros or Sonic the Hedgehog etc. I've just finished putting something together and I'd love to get any opinions on how it feels or ways to make it better. The graphics are extremely basic because I'm just focusing on the mechanics for now.
My biggest problem with it is in making jumping through platforms feel nice. Currently if the bottom of the player is intersecting a floor tile, the player is moved above it to stand on it. However this results in the player being put up on a platform when it doesn't feel like he should be. I'd like to make it so that a platform is only detected when the player's feet just slightly intersect it by up to half a tile.
Arrow keys to move
"Z" key to jump
-Horizontal and vertical acceleration
-Variable jump height based on length of time button is held
-Variable jump height based on horizontal speed of player at time of jump
It seems to run slower in a browser than in Pico-8. My code isn't currently very efficient, perhaps that's the reason.
I ran into a lot of issues with ground checking when I tried to make a character jump. I was doing pixel color checking rather than map checking but maybe there's something from that discussion you can pick from too.
Not saying that solves or adds anything to your situation, just a thread about platform jumping.
@matt Thanks for that link, it's got a ton of useful information in it :)
@tyroney I think some of the "thick air" feeling is coming from it running slower in a browser. I might be wrong though. I'll keep working on trying to make it better.
By playing a little with it, i feel there is something strange with the inertia of the character.
He stops quite instantly when no direction are pushed but the delay to change direction is very high. There is also a bug when changing direction at max speed, the character doesn't take account the button is pressed (it is because at max speed the acceleration is set to 0, and when a button is pressed the friction is set to 0, then the speed which depends of acceleration and friction doesn't change).
To manage speed limit and friction, why doesn't do like in jelpi : speed*=friction (with 0<friction<1) . It automatically stops the character and also it is an implicit speed limit management : at a high speed, the friction becomes higher than the acceleration.
For a more "like mario" feeling, you could consider that when the character changes direction, it doesn't modify the acceleration but the friction. (You could even make a brake state with a specific animation)
At high altitude, the falling speed is so high it make the character go through the plateform, you should also make a vertical speed limit to avoid this.
[Please log in to post a comment]