gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > Mario platformer or R-type shooter Help

#151258 - mrhaboobi - Fri Feb 22, 2008 2:08 am

Hey GUys.

Quite new to all of this, im looking for a tutorial or documented code for a mario type platformer or r-type shooter. Obviously i can get a graphic on the screen but what im really unsure of is the players movements. Mario has a certain way in which he jumps, and they way he moves up and down, so im wondering if there are any tutorials on how to do playermovement, or bullet patterns for a shooter. Any links to this type of resource would be great, even if there are some old 2d gaming books, i might be able to pick them up..

THanks alot.

#151261 - tepples - Fri Feb 22, 2008 2:27 am

The way Mario jumps is mostly Newtonian gravity. On each frame:

dy += constant (gravity)
dx += horizontal tweaking from controller
y += dy
x += dx

You'll also need to tweak dy to let the player control the jump height.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#151277 - elwing - Fri Feb 22, 2008 10:08 am

tepples wrote:
The way Mario jumps is mostly Newtonian gravity. On each frame:

dy += constant (gravity)
dx += horizontal tweaking from controller
y += dy
x += dx

You'll also need to tweak dy to let the player control the jump height.


to add more detail isn't it something like:
dy += environement factor[ex: air,water] *(force applied to the object[ex:gravity] + action[ex:jump, swim, climb])
dx += environement factor[on ice, regular surface, water]*(force applied to the object[ex: wind]+action[move right, move left])

and you didn't mention something pretty important:
limit dy and dx, you do not want a player running at 200kmh? through it might be a good idea on some spaceshooter or racing game

#151390 - mrhaboobi - Mon Feb 25, 2008 3:51 am

Thanks for the replies guys.. I will look more into this.. but if anyone has some more examples or tutes please send them through :)