Switch branches/tags
Nothing to show
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Morgan McGuire, 2017. Open Source under the BSD or MIT license--your choice!

This is code demonstrating how to simulate player-character movement in a 2D platformer with the following features:

This is programmed in the style of PICO-8 lua with the assumption of 8x8 pixel sprites (which is why it has only lower-case letters and is designed to minimize tokens). See:

  • platformer.lua for the fully-commented version and
  • platformer-min.lua for a more minimalist version.

This assumes the following functions:

  • hsolid(x, y1, y2) returns true if pixel (x, y1) or (x, y2) is solid with respect to horizontal movement
  • vsolid(x1, y, x2) returns true if pixel (x1, y) or (x2, y) is solid with respect to vertical movement
  • friction(x, y) returns the friction multiplier (tuned for 0-8) for the block at pixel (x, y)