Skip to content

The physics of Mario

pcmoritz edited this page Sep 13, 2010 · 2 revisions

1.) The coordinate system

The place where Mario starts is the point (32, 0); after the start, Mario falls down, for example to (32, 175). That means, the system is oriented like this:

0————> x
|
|
v
y

The length of the screen (22 units) is 22*16.0 floating point units (as the width).

2.) Movements

Let us denote Mario’s position with s and the discrete velocity with d. Then, for a normal walk, the following transformation is made every frame:
d <- d + (v, 0), where v = 0.6 in normal-mode and v = 1.2 for speed-mode
d <- d * inertia, where inertia is 0.89
s <- s + d
Then, s and d are saved for the next frame.

Clone this wiki locally