 // ---------------
 void game_over() {
   M5.Lcd.fillScreen(TFT_BLACK);
-  EEPROM_Read(&maxScore,0);
+  maxScore = EEPROM.readInt(address);
   
   if(score>maxScore)
   {
-    EEPROM_Write(&score,0);
+    EEPROM.writeInt(address, score);
+    EEPROM.commit();
     maxScore = score;
     M5.Lcd.setTextColor(TFT_RED);
     M5.Lcd.setTextSize(2); 

// By Ponticelli Domenico.
// https://github.com/pcelli85/M5Stack_FlappyBird_game

#include <M5Stack.h>


void resetMaxScore()
{
  EEPROM.writeInt(address, 0);
  EEPROM.commit();
}

