Page 1 of 1
Concepts behind platformererer
Posted: Sun May 09, 2010 11:37 am
by PaperDuckyFTW
Hi yall
Can any of you graciously tell me or provide a link to somewhere discussing the concepts behind a platform game? All im in need of is gravity and jumping. You dont have to go full out with inertia or calculating gravity using that 9.8ms-2 whatever - just something that gets the job done. Oh and uhh concepts behind bullet and shoting woud be appreciated as well ^.^b
I know it may be arrogant/nooby to ask for code which is why all im primarily asking for is the concepts or main goal behind it, then i can figure out how to impliment or make thes concepts. Thanks to eveyone who can help =]
Take it easy and crap i just rememberd i have homework >.>
Re: Concepts behind platformererer
Posted: Sun May 09, 2010 11:45 am
by Randi
I'm not too sure, but to jump, just put a jump animation and change the y coordinate, and for gravity have a timer to lower the y coordinate
Re: Concepts behind platformererer
Posted: Sun May 09, 2010 2:22 pm
by Lord Pingas
Re: Concepts behind platformererer
Posted: Sun May 09, 2010 7:20 pm
by XianForce
Well I don't have a link, but a basic explanation would be something like this:
Your character has an x and y velocity, when the 'jump' key is pressed you decrease the y velocity (in most cases at least, because down is usually positive). Then you have a gravitational acceleration, which is going to be positive if the y velocity is negative, negative if the y velocity is positive.
So basically, let's give some theoretical values:
Bob is walking along the ground and wants to jump over a stump, so he jumps (note: the jump itself usually doesn't affect the x velocity) which causes his y velocity to decrease to -10 pixels per frame. Then every frame, we add the y velocity to the y coordinate of Bob, but to account for gravity, we also add a gravity constant to the y velocity, something like 3 pixels per frame let's say. So for 3 frames, Bob will travel up, and will reach his peak, then he will travel down. To make sure Bob doesn't fall through the floor, you need to implement some type of ground/tile collisions, and reset the y velocity to 0 when Bob hits the ground.
So throughout this example, the stuff pertaining to jumping never affected the x velocity, which will give Bob's jump a parabolic appearance.
Hope that helps.
Re: Concepts behind platformererer
Posted: Mon May 10, 2010 1:58 pm
by xiphirx
Well, with platformers, I usually have the player constantly falling down, and when a jump is triggered, I usually do a yvel = -10, and it gives you a nice parabola.
So, in your over all loop, put something like y += yvel, and on the jump event, do a yvel = yvel + 1
Bullets are easy, just make a class for them. When you shoot, make instances of the class.
Re: Concepts behind platformererer
Posted: Wed May 12, 2010 4:48 am
by PaperDuckyFTW
yay!!!
I was about to post a problem but my internet decided to cock up just before i prssed "submit" and yerr my message got erased =( But then i had a go at fixing the problem and its all better now ^.^ Thanks everyone for you're help and thanks for the bullet idea xiphirx, i just feel stupid that i didnt think of that
Wish everone who reads thsi and especially everyone who helped out all the best
Take care,
MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE