Skip to content

Commit 13e3954

Browse files
Fixed a really fun bug with the ball
This bug was found after I tried making a level that used the ball lol.
1 parent 2101308 commit 13e3954

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/game/playing/physics/ball.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@ pub fn physics_handle(
66
on_ground: &mut bool,
77
velocity_y: &Cell<f32>,
88
gravity: &Cell<f32>,
9+
jump_force: &Cell<f32>,
910
player_y: &mut f32
1011
) {
1112
velocity_y.set(velocity_y.get() + gravity.get());
1213

1314
if *on_ground && (is_mouse_button_pressed(MouseButton::Left) || is_key_pressed(KeyCode::Space) || is_key_pressed(KeyCode::Up)) {
1415
gravity.set(-gravity.get());
16+
jump_force.set(-jump_force.get());
1517
*player_y = if gravity.get() > 0.0 { *player_y + 1.0 } else { *player_y - 1.0 };
1618
velocity_y.set(if gravity.get() > 0.0 { 5.0 } else { -5.0 });
1719
*on_ground = false;

src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -905,7 +905,8 @@ async fn main() {
905905
&mut on_ground,
906906
&velocity_y.0,
907907
&gravity.0,
908-
&mut player.y
908+
&jump_force.0,
909+
&mut player.y,
909910
);
910911
}
911912

0 commit comments

Comments
 (0)