Hi, I was wondering if I could get some feedback on how to attack the engine of a 2D environment (sideview).
I currently have a character in a single room (one level) that can move around and jump. The way I use the jump method is by initializing a Y position when the jump key is pressed and another when the character reaches the peak of his jump (ex: vf = vi + at
2... all of those happy kinematic formulas). Everything works perfectly. At least it looks good... (thats all that matters, right?)
Anyways, I was wondering if that was a decent way to go about things when making a sidescrolling environment. I was also wondering if anybody had any ideas on movements on an incline (ex: stairs/hills). I was thinking about doing something like:
Collision (person a, floor b)
{
if (b.size.top == a.size.bottom + 1)
{
a.position.y += 1;
return true;
}
else
{
return true;
}
}
So basically, I would be seeing if the floor the character would be running into would be 1 pixel greater than where he is, and if it is, it will move him up 1 pixel.
I'm still learning, so if anybody has an even better logical method or something.. that would be much appretiated ^^