Skip to content

Commit 754e68e

Browse files
authored
Add walk animation to townies (#2145)
### RandomTextureSpriteBehavior: Allow idle + walk animation Assets: - Rename existing part assets to "idle". - Add walk animation for the legs part. RandomTextureSpriteBehavior: - Export an Array of SpriteFrames resources. Instead of using the custom addon to change the textures. Townie scene: - Add a CharacterSpriteBehavior to each part. And configure the legs part with the new animations. - Add one .tres file per body part variant. And configure each Array of SpriteFrames resources with them. Townie demo: - Add a FollowWalkBehavior to one townie, and remove the TalkBehavior. ### CharacterSpriteBehavior: Reset frames when back to idle The townies "idle" has a subtle up and down animation. For a character made of parts, since the last commit one part (like the head) may keep playing "idle" while another (like the legs) may play "walk". But when the character is back to idle, all parts should be set in sync again. Otherwise, the head may go up when the legs go down, making a funny but not desired (for now) dance. ### CharacterSpriteBehavior: Fallback to idle when walk is not available When the SpriteFrames animation doesn't have an animation named "walk", use its "idle" animation for walking. This makes the modding easier, since a single animation is now needed for start testing a SpriteFrames in a character with any of the walk behaviors. We also use "idle" at double speed for running. And also, when a character is made of multiple parts, some parts can stay in the "idle" animation. Meaning there are less parts to draw.
1 parent f4785b5 commit 754e68e

62 files changed

Lines changed: 1576 additions & 266 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

scenes/game_elements/characters/components/character_randomizer.gd

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ func _randomize_all_sprites_progress() -> void:
131131
var random_frame := randi_range(0, frames_length)
132132
var random_progress := randf()
133133
for sprite in animated_sprites:
134+
sprite.play("idle")
134135
sprite.set_frame_and_progress(random_frame, random_progress)
135136

136137

0 commit comments

Comments
 (0)