All examples · Physics · As Markdown, for AIs

Grow and shrink

What this example shows

A body whose size is part of the game: the hero is small, a mushroom makes it big, and a hit while big makes it small again. Changing record.collider.width and height is all it takes: the body is that size from the next step on, a body standing when it changes keeps its feet where they were, and one that grew into a wall comes out of it. isRetroAreaFree2d lets it grow only where the big body fits, so never into a ceiling.

Hurt, it goes through the walkers for a moment with collidesIf, blinking. onEnter with contact.side tells a stomp (landing from above) from a hit. The tunnel on the right is lower than the big hero: only the small one goes through. Arrows to move, up or Z to jump.

Starting
Starting
—