Skip to content

Commit

Permalink
new enemy animation naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Lamby777 committed Mar 7, 2024
1 parent 9836c1c commit a55fb53
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
6 changes: 3 additions & 3 deletions pets-gd/scenes/walking_enemy.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ animations = [{
"texture": ExtResource("1_8afda")
}],
"loop": true,
"name": &"Idle",
"name": &"ANONNYMOUSE-Idle",
"speed": 0.0
}, {
"frames": [{
Expand All @@ -22,7 +22,7 @@ animations = [{
"texture": ExtResource("3_saoe0")
}],
"loop": true,
"name": &"Run",
"name": &"ANONNYMOUSE-Run",
"speed": 6.0
}]

Expand All @@ -37,7 +37,7 @@ collision_layer = 8
position = Vector2(0, -8)
scale = Vector2(4, 4)
sprite_frames = SubResource("SpriteFrames_hs7pi")
animation = &"Idle"
animation = &"ANONNYMOUSE-Run"

[node name="CollisionShape2D" type="CollisionShape2D" parent="."]
rotation = 1.57079
Expand Down
7 changes: 4 additions & 3 deletions pets-lib/src/world/enemy_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ impl WalkingEnemy {
let mode_str = if moving { "Run" } else { "Idle" };

// TODO uncomment when backwards sprites are added
// let dir_str = if backwards { "Back" } else { "" };
// let anim_name = format!("{mode_str}{dir_str}");
let dir_str = ""; // if backwards { "Back" } else { "" };

self.sprite.set_animation(mode_str.into());
let anim_name = format!("{}-{}{}", self.enemy_id, mode_str, dir_str);

self.sprite.set_animation(anim_name.into());
self.sprite.set_flip_h(flipped);
}
}
Expand Down

0 comments on commit a55fb53

Please sign in to comment.