Concepts behind platformererer

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
PaperDuckyFTW
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 76
Joined: Sat Apr 03, 2010 5:08 am
Programming Language of Choice: C++

Concepts behind platformererer

Post 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 >.>
Randi
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 50
Joined: Sat Apr 24, 2010 1:32 pm
Location: Noobville

Re: Concepts behind platformererer

Post 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
User avatar
Lord Pingas
Chaos Rift Regular
Chaos Rift Regular
Posts: 178
Joined: Thu Dec 31, 2009 9:33 am
Favorite Gaming Platforms: NES, SNES, Nintendo 64, Dreamcast, Wii
Programming Language of Choice: C++
Location: Hiding In My Mum's Basement With My Pokemon Cards

Re: Concepts behind platformererer

Post by Lord Pingas »

XianForce
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 767
Joined: Wed Oct 29, 2008 8:36 pm

Re: Concepts behind platformererer

Post 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.
User avatar
xiphirx
Chaos Rift Junior
Chaos Rift Junior
Posts: 324
Joined: Mon Mar 22, 2010 3:15 pm
Current Project: ******** (Unkown for the time being)
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Contact:

Re: Concepts behind platformererer

Post 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.
StarCraft II Zerg Strategy, open to all levels of players!

Looking for paid work :< Contact me if you are interested in creating a website, need a web design, or anything else you think I'm capable of :)
PaperDuckyFTW
Chaos Rift Cool Newbie
Chaos Rift Cool Newbie
Posts: 76
Joined: Sat Apr 03, 2010 5:08 am
Programming Language of Choice: C++

Re: Concepts behind platformererer

Post 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 :nono:

Wish everone who reads thsi and especially everyone who helped out all the best
Take care,
MEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE :mrgreen:
Post Reply