Sign in to follow this  
BS-VecVidjeno

SDL-platform game start

Recommended Posts

I've created a tile system and tried to get the gravity going, but i coulden't do it!!!! Could anybody help me with starting my platform game and making my caracter jump, I've already made a walking character, and an animation class, but i have no way of making jump's and gravity? does anybody have experience?

Share this post


Link to post
Share on other sites
Depends on how you are handling the characters. Are they sprites? (I couldn't imagine they would be anything else)

If it's a sprite, it's a matter of moving it. You could base this on a timer, and just move it a certain amount each time. You could also use an external 2D physics engine that will figure out from the sprites different kinetic parameters where it should go. Your last option would be to code that engine yourself (which gives experience).

Hard to give any examples without code (or a thorough explanation) though.

FlyingIsFun1217

Share this post


Link to post
Share on other sites
The thing is that i've made the animation and the camera and the movement and gravity, but i cant get the collision and responce right? how do i make the responce that when i collide with the top part of my tile ( the part i walk on)???

Share this post


Link to post
Share on other sites
Quote:
right now im using the standard one...

So by standard do you mean intersecting rectangle collision?

I will assume so for now as I don't have anything else to go on. Just remember that in it's simplest form you are just moving around rectangles and the graphics don't matter to the CPU.

What I do in this instance is instead of moving my sprites and then checking for collision, I calculate the new position of the sprite and generate a collision rectangle for where he will be moving IF a collision is not detected. Since collision detection is assumed to be rectangle vs rectangle this should be simple to accomplish. If a collision happens then from there you have options depending on the type of game. Accept the change in position and continue or don't accept the change and modify some characteristics of the sprite based on what they collided with.

It isn't really the physics side of this type of collision that are difficult, it is the gameplay or reaction side that can become confusing because this is where you as a programmer have to make decisions.

I do recommend that physics are done at a fixed time step or at least not tied to the frame rate as large time steps will cause your physics to appear buggy at best.

Hope that helps!

Share this post


Link to post
Share on other sites
Hey, I'd like to create a platform game with you using SDL!

IM: coden4fun@hotmail.com

I'll be on all day, or fluctuate between being on and off, so just give me an IM and I'll help you out with this game if ya want me to!

Peace

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this