I'm currently working on the University project in which we have to team up with a design 'team' and create a 10 level platform game.
Now I have the basis of the engine working, although their are some flaws. Currently my collision detection is as follows:
public bool OnCollision(Geom g1, Geom g2, ContactList contactList)
return IsonGround = true;
public void OnSeparation(Geom g1, Geom g2)
IsonGround = false;
//Within the Update method
if (IsonGround == true && s.IsKeyDown(Keys.W))
circleSprite.Body.ApplyImpulse(new Vector2(0.0f, -100f));
This creates a realistic jump with regards to gravity enabled.
The players collision at his feet will enable him to jump once more, but all of the sides of the player can cause the collision.
The Issue I am having is that if the sprite (being a rectangle) hits the side of a wall, the collision is True and he will beable to wall run(not a skill I wish my young pixel to have).
Could someone please post some example code and explain how to manipulate certain sides of the rectangle, I have looked over a few other topics and they explain the principle but I cannot produce practical code for it to be effective.
Thank you very much.