My name is Keith, and I've probably posted on these forums maybe a few times at most. I was working on an adventure game, but that got tabled for the time being.
Currently I'm going to make a Sonic The Hedgehog styled platformer called Flash Fox. The reason I mentioned "going to" is because I'm working on implementing slopes (using
LÖVE). It works to a point, let me explain --
The collision seems to work great, and you can move at high speed without tunneling through the tiles.
I have acceleration and deceleration working and if you're jumping from a near-to-complete stop it will jump in an arc away from the slope angle, that is, that it uses the normal of the slope in order to jump in the opposite direction.
So the problem is, that I can't jump up when traveling quickly uphill. This is for at least 3 reasons:
1) Gravity is always pulling it down
2) In order to stay on the slope at all when moving horizontally I have to set the y position (the floor position) based on how far into the tile the sprite is intersecting
3) moving uphill cancels out the jumping velocity somehow.
So here I will show you a video (please click on the image). Look at the first 4 seconds of the clip as these show me trying to jump while moving up hill.
Here's the actual project with the source code, which since love2d is lua, the source is in lua.
SSE03.zipPlease note, if you unzip this, you need to unzip it into a folder, and if you have love2d, you can simply rename the zip file to .love and run it directly in love2d.
pay attention to player.lua mostly as that has the collision/slope code. The function DoJump and UpdateHorz/UpdateVert functions are the main functions that move the sprite.
So a quick recap I want to be able to jump up even when moving uphill at a quick pace.
Any help you could give would be appreciated.