Skip to content

Commit 66838e8

Browse files
committed
fixed animation looping after movement finished
1 parent 603a066 commit 66838e8

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

pets-gd/dialogue/lyembo1.gd

+4
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,7 @@ func _start() -> void:
66
"I don't know what to say.",
77
"My name is L'yembo. Maybe we'll meet again someday.",
88
])
9+
10+
var lyembo = get_parent().get_parent()
11+
lyembo.move_to_relative(-100.0, 0.0)
12+
await lyembo.motion_done

pets-lib/src/world/pchar_node.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -92,20 +92,25 @@ impl INode2D for PCharNode {
9292

9393
fn physics_process(&mut self, delta: f64) {
9494
if let Some(target) = self.cutscene_motion {
95+
let mut moving;
96+
9597
let own_pos = self.base().get_global_position();
9698
let input_vector = Inputs::iv_from_to(own_pos, target);
9799

98100
self.base_mut().set_global_position(
99101
own_pos + input_vector * MAX_SPEED * delta as real,
100102
);
101103

102-
self.anim_move(true, input_vector);
104+
moving = true;
103105

104106
if (target - own_pos).length() < CUTSCENE_MOTION_CLOSE_ENOUGH {
105107
self.cutscene_motion = None;
106108
self.base_mut().emit_signal("motion_done".into(), &[]);
107109
self.base_mut().set_global_position(target);
110+
moving = false;
108111
}
112+
113+
self.anim_move(moving, input_vector);
109114
}
110115
}
111116
}

0 commit comments

Comments
 (0)