Decoration in the options menu

This commit is contained in:
theo@manjaro 2021-09-16 08:34:40 +02:00
parent 87731f167b
commit 16c0e57376
6 changed files with 21 additions and 10 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 515 KiB

View File

@ -7,11 +7,8 @@ class MenuBackground(BaseObject):
# Islands
self.sprite = game.sprite_lib["ingame.png"]
# Shadow sprite
shadow = game.sprite_lib["shadow.png"]
self.shadow = game.pygame.transform.scale(shadow,(1500,1500)) # J'augmente la taille de l'ombre
self.depth = 0
self.depth = -2
self.cameraratio = 0.1
@ -26,4 +23,3 @@ class MenuBackground(BaseObject):
def draw(self):
game = self.game
game.window.blit(self.sprite,[-game.globals["camerax"]*self.cameraratio,-game.globals["cameray"]*self.cameraratio])
game.lib.drawcenter(game,self.shadow,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT*3/5)

View File

@ -27,6 +27,14 @@ class MainMenu(menu.Menu):
self.create(self.grid,self.rect)
self.depth = -1
# Shadow sprite
shadow = game.sprite_lib["shadow.png"]
self.shadow = game.pygame.transform.scale(shadow,(1000,1000)) # J'augmente la taille de l'ombre
def draw(self):
# Shadow
self.game.lib.drawcenter(self.game,self.shadow,self.game.DISPLAY_WIDTH/2,self.game.DISPLAY_HEIGHT*3/5)
# Display game title
self.game.lib.drawcenter(self.game,self.game.sprite_lib["gui/title.png"],self.game.DISPLAY_WIDTH/2,self.baserect[1]-self.game.DISPLAY_HEIGHT/8)

View File

@ -14,3 +14,8 @@ class OptionMenu(menu.Menu):
]
self.create(self.grid,self.rect)
self.depth = -1
def draw(self):
self.game.window.blit(self.game.sprite_lib["gui/optionsbg.png"],[0,0])

View File

@ -69,11 +69,11 @@ class Slider(base.BaseObject):
game = self.game
game.window.blit(self.bgsprite,(self.baserect[0]-game.globals["camerax"],self.baserect[1]-game.globals["cameray"]))
game.window.blit(self.sprite,(self.rect[0]-game.globals["camerax"],self.rect[1]-game.globals["cameray"]))
game.window.blit(self.bgsprite,self.baserect[:2])
game.window.blit(self.sprite,self.rect[:2])
txt = game.fontfile.render(str(round(self.currentvalue))+self.posttext,False,[255]*3)
px = self.baserect[0]+self.baserect[2]+50-game.globals["camerax"]
py = self.rect[1]+self.rect[3]/2-txt.get_height()/2-game.globals["camerax"]
px = self.baserect[0]+self.baserect[2]+50
py = self.rect[1]+self.rect[3]/2-txt.get_height()/2
game.window.blit(txt,[px,py])

View File

@ -32,7 +32,8 @@ def ingame(game):
game.gameloop.summon(Manager(game))
def options(game):
game.gameloop.reinit()
game.gameloop.delname("Button")
game.gameloop.delname("MainMenu")
game.globals["camerax"] = 0
game.globals["cameray"] = 0
s = BGMSlider(40,40,game,400,40)
@ -40,6 +41,7 @@ def options(game):
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(s2)
game.gameloop.summon(menu)
def gameover(game):
game.gameloop.reinit()