An animated door
By the end you will have a door that blocks the hero while it is closed, swings open with an animation, and then lets the hero through.
What you need
Is overlapping another object and Is playing an animation are Advanced. Switch to Advanced mode.
| Door | + Add object → Library → Door. It comes with a closed and an open animation. |
|---|---|
| Hero | Hero (top-down) for a maze, or Hero for a platformer. |
| Key | Key from the library. |
| Sound | Door. |

Why a rule, not a setting
Sprites are never solid. Only tiles, Blocks and backgrounds block things. So a door sprite needs a rule that says "while I am closed, push the hero back". When the animation changes to open, that rule stops being true, and the hero walks through.
Build it
- Double-click the Door to open the Sprite editor. In the Animation select, look at closed and open. Press ⌘2 to go back.
- Click the Door in the level and make sure it is playing closed at the start (that is the library's default).
- Events tab → + New event → Hero → Is overlapping another object → Door. + and… → Door → Is playing an animation → closed.
- In the Hero cell choose Stop, then Set position: X −6, Y 0, Measured from Hero. The hero is nudged back out of the door.
- + New event → Hero → Collides with another object → Key. Do Destroy Key and, in Door, Change animation → open. Play Door.
- Press ▶ Play level. Push against the door: it holds. Get the key: it opens, and you walk through.
WhenHero is overlapping DoorDoor is playing “closed”
DoStop HeroSet position of Hero to (−6, 0) from Hero
WhenHero collides with Key
DoDestroy KeyMake Door play “open”Play sound Door
The nudge direction depends on where the hero comes from. X −6 pushes left. Use X 6 for a door on the left, or Y 6 for one above.
Make it yours
- Draw your own door: open the Sprite editor, add a New animation name called open, and draw a few pictures.
- Open with a switch instead of a key: Upon pressing key E + Hero Is near Door, closer than 40 → open.
- Simple-mode version: skip the overlapping rule and Destroy the door when you have the key.