Added reset button

This commit is contained in:
theo@manjaro 2021-09-19 15:58:01 +02:00
parent f968827b7b
commit aa631c188e
2 changed files with 18 additions and 0 deletions

View File

@ -0,0 +1,15 @@
from gamedata.objects.button import Button
class Reset(Button):
def __init__(self,x,y,game,w,h):
super().__init__(x,y,game,w,h)
self.text = "Reset save"
def reset(self,game):
game.globals["highscore"] = 0
game.scene = game.scenes.main
self.click = reset

View File

@ -9,6 +9,7 @@ from gamedata.objects.ingame.manager import Manager
from gamedata.objects.gameover import GameOver from gamedata.objects.gameover import GameOver
from gamedata.objects.ingame.skies import Skies from gamedata.objects.ingame.skies import Skies
from gamedata.objects.ingame.clouds import Clouds from gamedata.objects.ingame.clouds import Clouds
from gamedata.objects.resetbutton import Reset
def main(game): def main(game):
game.scaleCamera() game.scaleCamera()
@ -38,9 +39,11 @@ def options(game):
game.globals["cameray"] = 0 game.globals["cameray"] = 0
s = BGMSlider(40,40,game,400,40) s = BGMSlider(40,40,game,400,40)
s2 = SFXSlider(40,100,game,400,40) s2 = SFXSlider(40,100,game,400,40)
btn = Reset(40,160 ,game,400,40)
menu = OptionMenu(round(game.DISPLAY_WIDTH/8),round(game.DISPLAY_HEIGHT*9/10),game,round(game.DISPLAY_WIDTH*6/8),round(game.DISPLAY_HEIGHT/10-game.DISPLAY_HEIGHT/30)) menu = OptionMenu(round(game.DISPLAY_WIDTH/8),round(game.DISPLAY_HEIGHT*9/10),game,round(game.DISPLAY_WIDTH*6/8),round(game.DISPLAY_HEIGHT/10-game.DISPLAY_HEIGHT/30))
game.gameloop.summon(s) game.gameloop.summon(s)
game.gameloop.summon(s2) game.gameloop.summon(s2)
game.gameloop.summon(btn)
game.gameloop.summon(menu) game.gameloop.summon(menu)
def gameover(game): def gameover(game):