Making A 2d Physics Engine
This is the first article in the Making a 2D Physics Engine Series. Making a 2D Physics Engine: The Math Making a 2D Physics Engine: Spaces and Bodies Making a 2D Physics Engine: Shapes, Worlds and Integration Making a 2D Physics Engine: Mass, Inertia and Forces Physics in games helps us simulate a. Mammas and papas ireland.
Free Physics Engine
To start out I want to say I am making a 2D side scrolling video game. The game is coded in C# and the framework is with XNA. I was wondering what is an easy way to make a basic physics engine might be, and where to put it. My experience with XNA isn't to extensive but I know enough to make a game without physics, so naturally the now I wish to add physics (a jump feature that then pulls the player down). My goal is to end up with similar physics to Terraria or Super Mario. Any ideas on where to start? I know I will need at least a vector to pull the player down and another to push the player up, but thats as much as I know..
Tshepang1 Answer
Unless you need the player to push things around and by physics, you mean just jumping, then implementing jumping as in traditional sidescrollers is simple.
You might want to do something like this:
Of course, you might want to refactor and beautify this code, make the position and velocity changes dependent on seconds elapsed etc.
If you don't know how to implement the collision functions, consider reading up on keywords '2D collision detection' or 'sidescroller/platformer tutorial'.