-
Notifications
You must be signed in to change notification settings - Fork 0
Event Reference
Home | Preset Guide | Full Action Reference
This page documents all available events in PyGameMaker. Events are triggers that execute actions when specific conditions occur in your game.
- Object Events - Create, Step, Destroy
- Input Events - Keyboard, Mouse
- Collision Events - Object collisions
- Timing Events - Alarms, Step variants
- Drawing Events - Custom rendering
- Room Events - Room transitions
- Game Events - Game start/end
- Other Events - Boundaries, Lives, Health
| Property | Value |
|---|---|
| Name | create |
| Icon | 🎯 |
| Category | Object |
| Preset | Beginner |
Description: Executed once when an instance is first created.
When it fires:
- When an instance is placed in a room at game start
- When created via the "Create Instance" action
- After room transitions for new instances
Common uses:
- Initialize variables
- Set starting values
- Configure initial state
| Property | Value |
|---|---|
| Name | step |
| Icon | ⭐ |
| Category | Object |
| Preset | Beginner |
Description: Executed every frame (typically 60 times per second).
When it fires: Continuously, every game frame.
Common uses:
- Continuous movement
- Checking conditions
- Updating positions
- Game logic
Note: Be careful with performance - code here runs constantly.
| Property | Value |
|---|---|
| Name | destroy |
| Icon | 💥 |
| Category | Object |
| Preset | Intermediate |
Description: Executed when an instance is destroyed.
When it fires: Just before the instance is removed from the game.
Common uses:
- Spawn effects (explosions, particles)
- Drop items
- Update scores
- Play sounds
| Property | Value |
|---|---|
| Name | keyboard |
| Icon | ⌨️ |
| Category | Input |
| Preset | Beginner |
Description: Fires continuously while a key is held down.
Best for: Smooth, continuous movement
Supported Keys:
- Arrow keys (up, down, left, right)
- Letters (A-Z)
- Numbers (0-9)
- Space, Enter, Escape
- Function keys (F1-F12)
- Modifier keys (Shift, Ctrl, Alt)
| Property | Value |
|---|---|
| Name | keyboard_press |
| Icon | 🔘 |
| Category | Input |
| Preset | Beginner |
Description: Fires once when a key is first pressed.
Best for: Single actions (jump, shoot, menu select)
Difference from Keyboard: Only fires once per press, not while held.
| Property | Value |
|---|---|
| Name | keyboard_release |
| Icon | ⬆️ |
| Category | Input |
| Preset | Advanced |
Description: Fires once when a key is released.
Common uses:
- Stop movement when key released
- End charging attacks
- Toggle states
| Property | Value |
|---|---|
| Name | keyboard_no_key |
| Icon | ⌨️ |
| Category | Input |
| Preset | Advanced |
Description: Fires each frame while no key is being held.
When it fires: Every frame that the keyboard is idle, before the Step event.
Common uses:
- Stop movement when the player releases all keys (grid/maze games)
- Idle animations
| Property | Value |
|---|---|
| Name | mouse |
| Icon | 🖱️ |
| Category | Input |
| Preset | Intermediate |
Description: Mouse button and movement events.
Event Types:
| Type | Description |
|---|---|
| Left Button | Click with left mouse button |
| Right Button | Click with right mouse button |
| Middle Button | Click with middle/scroll button |
| Mouse Enter | Cursor enters instance bounds |
| Mouse Leave | Cursor leaves instance bounds |
| Global Left Button | Left click anywhere |
| Global Right Button | Right click anywhere |
| Property | Value |
|---|---|
| Name | collision |
| Icon | 💥 |
| Category | Collision |
| Preset | Beginner |
Description: Fires when this instance overlaps with another object type.
Configuration: Select which object type triggers this collision.
Special variable: other - Reference to the colliding instance.
When it fires: Every frame that instances are overlapping.
Common uses:
- Collecting items
- Taking damage
- Hitting walls
- Triggering events
Example collision events:
-
collision_with_obj_coin- Player touches a coin -
collision_with_obj_enemy- Player touches an enemy -
collision_with_obj_wall- Instance hits a wall
| Property | Value |
|---|---|
| Name | alarm |
| Icon | ⏰ |
| Category | Timing |
| Preset | Intermediate |
Description: Fires when an alarm countdown reaches zero.
Available alarms: 12 independent alarms (alarm[0] through alarm[11])
Setting alarms: Use the "Set Alarm" action with steps (60 steps ≈ 1 second at 60 FPS)
Common uses:
- Timed spawning
- Cooldowns
- Delayed effects
- Repeating actions (set alarm again in alarm event)
| Property | Value |
|---|---|
| Name | begin_step |
| Icon | |
| Category | Step |
| Preset | Advanced |
Description: Fires at the beginning of each frame, before regular Step events.
Execution order: Begin Step → Step → End Step
Common uses:
- Input processing
- Pre-movement calculations
| Property | Value |
|---|---|
| Name | end_step |
| Icon | ⏹️ |
| Category | Step |
| Preset | Advanced |
Description: Fires at the end of each frame, after collisions.
Common uses:
- Final position adjustments
- Cleanup operations
- State updates after collisions
| Property | Value |
|---|---|
| Name | draw |
| Icon | 🎨 |
| Category | Drawing |
| Preset | Intermediate |
Description: Fires during the rendering phase.
Important: Adding a Draw event disables automatic sprite drawing. You must draw the sprite manually if you want it visible.
Common uses:
- Custom rendering
- Drawing shapes
- Displaying text
- Health bars
- HUD elements
Available drawing actions:
- Draw Sprite
- Draw Text
- Draw Rectangle
- Draw Circle
- Draw Line
- Draw Health Bar
| Property | Value |
|---|---|
| Name | draw_gui |
| Icon | 🖥️ |
| Category | Drawing |
| Preset | Advanced |
Description: Draws in screen (GUI) space, on top of the room and unaffected by views/camera scrolling.
Difference from Draw: the regular Draw event is in room coordinates (it scrolls with the view); Draw GUI stays fixed to the screen — use it for HUDs, scores, and menus.
| Property | Value |
|---|---|
| Name | room_start |
| Icon | 🚪 |
| Category | Room |
| Preset | Advanced |
Description: Fires when entering a room, after all Create events.
Common uses:
- Room initialization
- Play room music
- Set room-specific variables
| Property | Value |
|---|---|
| Name | room_end |
| Icon | 🚪 |
| Category | Room |
| Preset | Advanced |
Description: Fires when leaving a room.
Common uses:
- Save progress
- Stop music
- Cleanup
| Property | Value |
|---|---|
| Name | game_start |
| Icon | 🎮 |
| Category | Game |
| Preset | Advanced |
Description: Fires once when the game first starts (in first room only).
Common uses:
- Initialize global variables
- Load saved data
- Play intro
| Property | Value |
|---|---|
| Name | game_end |
| Icon | 🎮 |
| Category | Game |
| Preset | Advanced |
Description: Fires when the game is ending.
Common uses:
- Save game data
- Cleanup resources
| Property | Value |
|---|---|
| Name | outside_room |
| Icon | 🚫 |
| Category | Other |
| Preset | Advanced |
Description: Fires when instance is completely outside room boundaries.
Common uses:
- Destroy off-screen bullets
- Wrap around to other side
- Trigger game over
| Property | Value |
|---|---|
| Name | intersect_boundary |
| Icon | |
| Category | Other |
| Preset | Advanced |
Description: Fires when instance touches the room boundary.
Common uses:
- Keep player in bounds
- Bounce off edges
| Property | Value |
|---|---|
| Name | no_more_lives |
| Icon | 💀 |
| Category | Other |
| Preset | Intermediate |
Description: Fires when lives become 0 or less.
Common uses:
- Game over screen
- Restart game
- Show final score
| Property | Value |
|---|---|
| Name | no_more_health |
| Icon | 💔 |
| Category | Other |
| Preset | Intermediate |
Description: Fires when health becomes 0 or less.
Common uses:
- Lose a life
- Respawn player
- Trigger death animation
| Property | Value |
|---|---|
| Name | animation_end |
| Icon | 🎞️ |
| Category | Other |
| Preset | Advanced |
Description: Fires when the instance's sprite animation completes a full cycle (wraps from the last frame back to the first).
Common uses:
- Destroy a one-shot effect (explosion) after it plays once
- Switch to another animation when the current one finishes
- Advance a state machine on animation completion
Understanding when events fire helps create predictable game behavior:
- Begin Step - Start of frame
- Alarm - Any triggered alarms
- Keyboard/Mouse - Input events
- Step - Main game logic
- Collision - After movement
- End Step - After collisions
- Draw - Rendering phase
| Preset | Events Included |
|---|---|
| Beginner | Create, Step, Keyboard Press, Collision |
| Intermediate | + Draw, Destroy, Mouse, Alarm |
| Advanced | + All keyboard variants, Begin/End Step, Room events, Game events, Boundary events |
- Full Action Reference - Complete action list
- Beginner Preset - Essential events for beginners
- Intermediate Preset - Additional events
- Events and Actions - Core concepts overview