Skip to content

Commit acc2463

Browse files
committed
Update Dodge-the-Creeps to new animation API
1 parent 1976246 commit acc2463

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

examples/dodge-the-creeps/rust/src/mob.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ enum MobType {
1010
}
1111

1212
impl MobType {
13-
fn to_str(self) -> String {
13+
fn to_str(self) -> GodotString {
1414
match self {
15-
MobType::Walk => "walk".to_string(),
16-
MobType::Swim => "swim".to_string(),
17-
MobType::Fly => "fly".to_string(),
15+
MobType::Walk => "walk".into(),
16+
MobType::Swim => "swim".into(),
17+
MobType::Fly => "fly".into(),
1818
}
1919
}
2020
}
@@ -63,7 +63,6 @@ impl GodotExt for Mob {
6363
let mut sprite = self
6464
.base
6565
.get_node_as::<AnimatedSprite2D>("AnimatedSprite2D");
66-
sprite.set_animation(animation_name.as_str().into());
67-
sprite.set_playing(true);
66+
sprite.set_animation(StringName::from(&animation_name));
6867
}
6968
}

examples/dodge-the-creeps/rust/src/player.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ impl GodotExt for Player {
9595
animated_sprite.set_flip_v(velocity.y > 0.0)
9696
}
9797

98-
animated_sprite.play(animation.into(), false);
98+
animated_sprite.play(animation.into(), 1.0, false);
9999
} else {
100100
animated_sprite.stop();
101101
}

0 commit comments

Comments
 (0)