Play Animated Image
Category: Image
Plays the animation of a .tscn animation scene already displayed via Show Image. Used as a playback switch for animations composed of consecutive images, such as flames, water splashes, explosions, and magic effects.
Prerequisites for this event content
To use this event content effectively, you must prepare the following in advance:
- A
.tscnanimation scene (AnimatedSprite2Dnode + multi-frameSpriteFrames) placed underdata/animated_sprites/etc. - The target
.tscnhas been displayed in advance via Show Image with a specified number.
To create animation scenes, place an AnimatedSprite2D node in a .tscn using the Godot native editor and set up SpriteFrames. Existing player characters (data/objects/*.tscn) and object templates make good references.
Works on still images (.png etc.) but with limited effect
When a still image is displayed via Show Image, a 1-frame animation named default is automatically generated. Executing this event content on it produces almost no visible animation movement.
Property List
| Item (tscn label) | Input Format | Description |
|---|---|---|
| Number | Numeric (0-99) | Number of the target image |
| Animation Name | Text | Name of the animation to play (defined within SpriteFrames). If blank, the first animation is automatically selected |
| Is Loop | Checkbox | ON = loop playback, OFF = play once (mutually exclusive with Hide After Play) |
| Hide After Play | Checkbox | ON = automatically erase image after animation completes (mutually exclusive with Is Loop) |
Property Details
Number
Specifies the number of the image on which to play the animation (integer 0-99, step 1).
- Specify the same value as the number used when displaying the image via Show Image with a
.tscn - If no image exists for the specified number, this event content does nothing and proceeds to the next event content
Animation Name
Specifies the name of the animation to play. Enter one of the animation names defined in SpriteFrames within the .tscn animation scene.
- Blank: The first animation in
SpriteFramesis automatically selected - Specified name does not exist: This event content does nothing and proceeds to the next event content (not an error)
Blank is OK when there is only one animation
If only one animation is defined in the .tscn, it is automatically selected even without specifying a name. Specifying a name becomes meaningful when switching between multiple animations.
Example: If the .tscn has three animations idle, attack, damage, specifying attack plays the attack animation.
Is Loop
Specifies whether to loop the animation.
- ON: When the animation ends, it restarts from the beginning (infinite loop)
- OFF: Stops when the animation ends (plays once)
Mutually exclusive with Hide After Play
Turning this property ON automatically sets Hide After Play to OFF. Since "erase after playback of something that loops infinitely" is logically contradictory, mutual exclusion is enforced on both the editor side and the runtime side.
Hide After Play
Specifies whether to automatically erase the image after animation playback completes.
- ON: After animation playback completes, the image is automatically erased along with its internal data (convenient for effect staging)
- OFF: The image remains in place after playback completes (stops on the last frame)
Ideal for single-shot effects
For single-shot staging such as explosions or light effects where "once played, it should disappear", turning this property ON saves the trouble of writing separate erase instructions (when the .tscn animation completes, the data is automatically cleared without needing to call Hide Image).
Mutually exclusive with Is Loop
Turning this property ON automatically sets Is Loop to OFF.
Runtime Behavior
When this event content is executed, the following processing occurs:
1. Verification of target image and animation data
In any of the following cases, this event content does nothing and immediately proceeds to the next event content (not an error):
- No image data exists for the specified number
- No image node exists
- No animations are defined in the
SpriteFramesof the.tscn - The specified animation name does not exist in
SpriteFrames(if blank, the first animation is auto-selected)
2. Application of animation settings
is_play_animation = trueanimation_name = specified animation name(or the first animation name)animation_is_loop = value of Is Loopanimation_hide_after_play= (forced false if Is Loop is ON, otherwise the value of Hide After Play)SpriteFrames.set_animation_loop()applies the loop setting for the animation (overrides the setting in the.tscn)
3. Start of animation playback
Calls AnimatedSprite2D.play(animation_name) to start the animation.
4. Immediately proceeds to next event content
This event content does not wait. It proceeds to the next event content immediately upon starting the animation (the animation progresses in the background).
Why there is no Is Wait property
This event content has no Is Wait property. Since the length of an animation is determined by the number of frames in the .tscn multiplied by the frame time, there is no point in specifying a fixed time.
If you want to wait for the animation to complete, specify it manually using Wait, or use the pattern [Loop ON + switch via external event].
5. Detection of playback completion (when Hide After Play is ON)
When is_playing() becomes false in _process, the following is performed:
is_play_animation = false(internal flag update)- If Hide After Play is ON:
enable = false-> internal processing erases data and deletes the node
Typical Usage Flows
Flow 1: Single-shot effect (explosion) - Hide After Play
Play an explosion scene and auto-erase:
- Show Image (Number 2, image
explosion.tscn, position screen center, fade-in time 0) - Play Animated Image (this event content) (Number 2, animation name blank, loop OFF, Hide After Play ON)
- (Animation progresses in the background, this event content ends immediately)
- Show Text <- Message during the animation
Flow 2: Looping background effect (flame)
Displaying flames that burn continuously:
- Show Image (Number 5, image
fire.tscn, position 400, 500) - Play Animated Image (this event content) (Number 5, animation name
burning, loop ON, Hide After Play OFF) - (Flames burn in an infinite loop)
- Other event processing -> Hide Image to stop when necessary
Flow 3: Switching between multiple animations
Switch animations on the same character portrait depending on the scene:
- Show Image (Number 1, image
char_a.tscn, position screen center) - Play Animated Image (this event content) (Number 1, animation name
idle, loop ON, Hide After Play OFF) <- Start idle animation - Show Text <- Conversation
- Play Animated Image (this event content) (Number 1, animation name
attack, loop OFF, Hide After Play OFF) <- Switch to attack animation - Play Animated Image (this event content) (Number 1, animation name
idle, loop ON, Hide After Play OFF) <- Return to idle
Flow 4: Waiting for animation completion (combined with Wait)
Make the next event wait until the animation completes:
- Play Animated Image (this event content) (Number 2, animation name
charge, loop OFF, Hide After Play OFF) - Wait (time 1.5 seconds) <- Manual wait matching the animation length
- Show Text <- Message after animation completes
Flow 5: Animation + parallel animations
Also execute movement and rotation while the animation is playing:
- Show Image (Number 1, image
char_run.tscn, position screen right edge) - Play Animated Image (this event content) (Number 1, animation name
run, loop ON) - Move Image (Number 1, position screen left edge, time 3.0, wait ON) <- Move while running
Flow 6: Magic chant -> activation -> effect erasure
An RPG-like magic staging flow:
- Show Image (Number 3, image
magic_charge.tscn) - Play Animated Image (this event content) (Number 3, animation name
charging, loop ON, Hide After Play OFF) - Show Text <- "Fireball!"
- Show Image (Number 3, image
fire_impact.tscn) <- Replace image - Play Animated Image (this event content) (Number 3, animation name blank, loop OFF, Hide After Play ON) <- Explosion activation + auto-erase
Typical Combinations
This event content is used on images displayed as .tscn animation scenes via Show Image. For the overall picture, see Combination Patterns.
Single-shot effect (explosion/light)
- Show Image (
.tscnimage) - Play Animated Image (this event content) (loop OFF, Hide After Play ON)
- (Animation progresses in the background, auto-erased on completion)
Looping background (flame, water splash, magic circle)
- Show Image (
.tscnimage) - Play Animated Image (this event content) (loop ON)
- ... Other events ...
- Hide Image <- Stop when necessary
Animation switching
Switch multiple animations on the same image node:
- Show Image (
.tscnwith multiple animations) - Play Animated Image (this event content) (animation name A, loop ON)
- ... Event progression ...
- Play Animated Image (this event content) (same number, animation name B, loop ON)
Parallel execution of animation + movement
Movement staging for a running character:
- Show Image (
.tscnimage) - Play Animated Image (this event content) (animation name
run, loop ON) - Move Image (wait until move completes)
Waiting for animation completion
Since this event content has no wait function, specify a wait separately:
- Play Animated Image (this event content) (loop OFF)
- Wait (same duration as the animation)
Related Event Contents
| Related Event Content | Use |
|---|---|
| Show Image | Prerequisite for this event content (display .tscn image in advance) |
| Hide Image | Stop/erase looping animation |
| Hide All Images | Batch erase all images |
| Wait | When you want to wait for animation completion |
| Move Image | Position animation in parallel with the animation |
| Rotate Image | Rotation in parallel with the animation |
| Scale Image | Scaling in parallel with the animation |
Related Pages
| Page | Related Content |
|---|---|
| Effect Tab | Similar functionality that uses AnimatedSprite2D scenes |
| Event Content List | List of all event contents |
Notes
.tscn animation scene is required
Even if executed on a still image (.png etc.), there is only 1 animation frame, so there is almost no movement. This event content is designed to target .tscn scenes containing multi-frame animations.
No wait function
This event content has no Is Wait property. After execution, it immediately proceeds to the next event content, and the animation progresses in the background. If you want to wait for the animation to complete, specify a wait manually using Wait.
No Skip clamping
Unlike Show Image and others, this event content has no clamp processing during Skip. This is because this event content is not a time-based animation (the animation length is determined by the .tscn frame count).
Is Loop and Hide After Play are mutually exclusive
- Loop ON + Hide After Play ON: Logically contradictory, so mutual exclusion is enforced in both editor and runtime
- In the editor, turning one ON automatically turns the other OFF
- In runtime, Hide After Play is forced OFF when Is Loop is ON
No error for non-existent animation names
If the specified animation name does not exist, this event content does nothing and proceeds to the next event content. When debugging, if the animation does not play, verify that the name is correct.
Parallelizable with other animations
Animation playback can operate in parallel independently with Move Image / Rotate Image / Scale Image / Shake Image. You can combine them, such as a running character changing position.
SpriteFrames loop setting is overridden
Even if the animation has loop=true/false configured on the .tscn side, it is overridden by this event content's Is Loop property.
