@@ -77,6 +77,7 @@ class Hud extends Box
7777 @segment = world. platform\ row!
7878 @progress = world\ progress!
7979 @player_life = world. player\ p_life!
80+ @player_score = world. player. display_score
8081
8182 @in_danger = world. active_block[ @segment ]
8283 @next_block = world. level[ world\ block_i! + 1 ] or {}
@@ -228,7 +229,7 @@ class Hud extends Box
228229 g. push!
229230 g. translate 100 , 16
230231 g. scale 2
231- box_text " score: 0 " , 0 , 0 , false
232+ box_text " score: #{f @player_score} " , 0 , 0 , false
232233 g. pop!
233234
234235class TitleScreen
@@ -272,7 +273,7 @@ class TitleScreen
272273class GameOver
273274 watch_class @
274275
275- new : ( player ) =>
276+ new : ( @game ) =>
276277 @viewport = EffectViewport scale : 3
277278
278279 on_key : ( key) =>
@@ -290,8 +291,8 @@ class GameOver
290291 g. push!
291292 g. translate 0 , 10
292293 p " Game Over" , 60 , 40
293- p " Level Reached: #{0 }" , 60 , 60
294- p " Score: #{0 }" , 60 , 70
294+ p " Level Reached: #{@game.current_level }" , 60 , 60
295+ p " Score: #{f @game.player.score }" , 60 , 70
295296
296297 p " Press enter to return to title" , 60 , 100
297298 p " Thanks for playing! &" , 60 , 110
0 commit comments