GameMaker: Shadow casting in platformer games

This is a very old example of mine actually (creation timestamp says Sep 2010), which I've recently fixed & improved at request.

It demonstrates a simple algorithm to cast shadow from instance in platformer game. So when player jumps, shadow is displayed on ground below (realism!).

For the sake of simplicity and performance, shadows are checked against bounding boxes by default. Pixel-perfect checking is added as a separate condition, requiring affected objects to be children of obj_complex.

If you're interested in how this works behind-the-scenes, here's an illustration:

Outlined instances are ones used for finding top-most position below the player (which shadow will be cast onto). Red line is a number of point checks to indicate top-most point on objects with precise masks.

As another random visual tweak, there's a piece of code added to make shadow shrink as caster gets further from ground. A small touch, but these add up over time.

Download GMK

GameMaker: Jetpack platformer

This is an older example of mine, featuring pixel-perfect movement and collision engine for jetpack platformer game. As extras, it includes particle spawning, and impact velocity calculations. Current version is updated to have a cleaner code style (no more bracket-less conditions and seriously doubtful operator combinations), as long as more comments (increasing comment coverage to a value close to 100%). Also there was a game being made around this concept once.

Download GMK

Love2d: Semi-turn-based platformer

A very rushed Haxe version to demonstrate how it looks in motion.
Does not necessarily represent features of love2d version in this post.

This was originally going to be a short reply-fix for a topic on love2d forum, but it seems that author did get somewhere with figuring that out on ones own, and I've quite overdone it in terms of a simple answer, so I formatted the code nicely, added several more features, and made this example.

Just in case above demonstration does not work, this example demonstrates a specific approach to game dynamic, where game logic occurs once per interval, while things are drawn and receive input at higher rate. I do not recall any actual platformer games that would use this principle, but a good example of such game is Snake (original grid-based version).
Example includes grid-to-point collision checking, actual specific platformer behaviour (with adjustable values), and value tweening (to make player movement nice & smooth).

Download (2KB .love)

Love2d: Platformer engine


Looks nice enough, right?

In free time of last days I've been developing earlier mentioned thing in Love2d, which is platformer engine.
One provides a simple framework for games that use combination of aligned tiles and dynamic objects.
As well it adds a easily modifiable system to load levels from strings, giving freedom for implementing level editors.

You can download a compiled version here or watch discussion thread on official forum here.