File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -66,7 +66,9 @@ impl Player {
66
66
67
67
if self . pos_y < 0. {
68
68
self . going_boom = false ;
69
+
69
70
self . pos_y = 0. ;
71
+ self . velocity = 0. ;
70
72
}
71
73
}
72
74
Original file line number Diff line number Diff line change @@ -222,13 +222,15 @@ impl Game {
222
222
223
223
pub fn inner_update ( & mut self , ctx : & mut Context ) -> GameResult < Option < crate :: Screen > > {
224
224
let ferris_pos_x = self . player . pos_x ;
225
- let mut ferris_is_falling_down: bool = true ;
225
+ let ferris_pos_y = self . player . pos_y ;
226
+
227
+ let mut ferris_is_falling_down = true ;
226
228
227
229
for tile in & mut self . ground {
228
230
let tile_start = tile. pos_x ;
229
231
let tile_end = tile. pos_x + 64. ;
230
232
231
- if ferris_pos_x >= tile_start && ferris_pos_x <= tile_end {
233
+ if ferris_pos_x >= tile_start && ferris_pos_x <= tile_end && ferris_pos_y + ( - HEIGHT / 2.0 ) - 64. >= ( - HEIGHT / 2.0 ) - 64. || ferris_pos_y == 0. {
232
234
ferris_is_falling_down = false ;
233
235
234
236
break ;
You can’t perform that action at this time.
0 commit comments