@@ -59,6 +59,8 @@ int state = 0;
5959float dt;
6060uint32_t lastTime = 0 ;
6161
62+ int localHighscore = 0 ;
63+
6264float offset = 0 ;
6365
6466int treeNumber = 0 ;
@@ -158,6 +160,11 @@ void render_tiles() {
158160 }
159161}
160162
163+ void render_title () {
164+ screen.blit (screen.sprites , Rect (0 , 96 , 65 , 16 ), Point (0 , 0 ));
165+ screen.blit (screen.sprites , Rect (0 , 112 , 76 , 16 ), Point (0 , 16 ));
166+ }
167+
161168void fade_background () {
162169 screen.pen = Pen (0 , 0 , 0 , 150 );
163170 screen.clear ();
@@ -212,7 +219,9 @@ void render(uint32_t time) {
212219
213220 fade_background ();
214221
215- screen.text (" Jumpy Squirrel" , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 4 ), true , TextAlign::center_center);
222+ // render_title();
223+
224+ screen.text (" Jumpy Squirrel" , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 3 ), true , TextAlign::center_center); // change to custom icon
216225
217226 screen.text (" Press A to Start" , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 2 / 3 ), true , TextAlign::center_center);
218227 }
@@ -238,9 +247,9 @@ void render(uint32_t time) {
238247
239248 fade_background ();
240249
241- screen.text (" You scored " +std::to_string (player.score ), minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 3 ), true , TextAlign::center_center);
250+ screen.text (" Score: " +std::to_string (player.score ), minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 3 ), true , TextAlign::center_center);
242251
243- screen.text (" You died " , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 4 ), true , TextAlign::center_center);
252+ screen.text (" Highscore: " + std::to_string (localHighscore) , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 1 / 2 ), true , TextAlign::center_center);
244253
245254 screen.text (" Press A to Retry" , minimal_font, Point (SCREEN_WIDTH / 2 , SCREEN_HEIGHT * 2 / 3 ), true , TextAlign::center_center);
246255 }
@@ -324,6 +333,7 @@ void update(uint32_t time) {
324333
325334 if (player.deadTimer >= DEAD_TIME) {
326335 state = 2 ;
336+ localHighscore = max (localHighscore, player.score );
327337 }
328338 }
329339 }
0 commit comments