Skip to content

Commit 8ca7087

Browse files
committed
remove option and replace oneditor for you_label
1 parent a6a0323 commit 8ca7087

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net-pong/rust/src/paddle.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ struct Paddle {
1212
motion: f32,
1313
you_hidden: bool,
1414
#[export]
15-
you_label: Option<Gd<Label>>,
15+
you_label: OnEditor<Gd<Label>>,
1616

1717
base: Base<Area2D>,
1818
}
@@ -41,7 +41,7 @@ impl IArea2D for Paddle {
4141
self.motion = input.get_axis("move_up", "move_down");
4242

4343
if !self.you_hidden && self.motion != 0.0 {
44-
self.you_label.as_mut().unwrap().hide();
44+
self.you_label.hide();
4545
}
4646

4747
self.motion *= MOTION_SPEED;
@@ -51,7 +51,7 @@ impl IArea2D for Paddle {
5151
let args = vslice![self.base().get_position(), self.motion];
5252
self.base_mut().rpc("set_pos_and_motion", args);
5353
} else if !self.you_hidden {
54-
self.you_label.as_mut().unwrap().hide();
54+
self.you_label.hide();
5555
}
5656

5757
let translation = Vector2::new(0.0, self.motion * delta as f32);

0 commit comments

Comments
 (0)