Decoration in the options menu
This commit is contained in:
parent
87731f167b
commit
16c0e57376
BIN
gamedata/assets/gui/optionsbg.png
Normal file
BIN
gamedata/assets/gui/optionsbg.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 515 KiB |
@ -7,11 +7,8 @@ class MenuBackground(BaseObject):
|
|||||||
|
|
||||||
# Islands
|
# Islands
|
||||||
self.sprite = game.sprite_lib["ingame.png"]
|
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
|
self.cameraratio = 0.1
|
||||||
|
|
||||||
@ -26,4 +23,3 @@ class MenuBackground(BaseObject):
|
|||||||
def draw(self):
|
def draw(self):
|
||||||
game = self.game
|
game = self.game
|
||||||
game.window.blit(self.sprite,[-game.globals["camerax"]*self.cameraratio,-game.globals["cameray"]*self.cameraratio])
|
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)
|
|
||||||
|
@ -27,6 +27,14 @@ class MainMenu(menu.Menu):
|
|||||||
|
|
||||||
self.create(self.grid,self.rect)
|
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):
|
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
|
# 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)
|
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)
|
||||||
|
@ -14,3 +14,8 @@ class OptionMenu(menu.Menu):
|
|||||||
]
|
]
|
||||||
|
|
||||||
self.create(self.grid,self.rect)
|
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])
|
||||||
|
@ -69,11 +69,11 @@ class Slider(base.BaseObject):
|
|||||||
|
|
||||||
game = self.game
|
game = self.game
|
||||||
|
|
||||||
game.window.blit(self.bgsprite,(self.baserect[0]-game.globals["camerax"],self.baserect[1]-game.globals["cameray"]))
|
game.window.blit(self.bgsprite,self.baserect[:2])
|
||||||
game.window.blit(self.sprite,(self.rect[0]-game.globals["camerax"],self.rect[1]-game.globals["cameray"]))
|
game.window.blit(self.sprite,self.rect[:2])
|
||||||
|
|
||||||
|
|
||||||
txt = game.fontfile.render(str(round(self.currentvalue))+self.posttext,False,[255]*3)
|
txt = game.fontfile.render(str(round(self.currentvalue))+self.posttext,False,[255]*3)
|
||||||
px = self.baserect[0]+self.baserect[2]+50-game.globals["camerax"]
|
px = self.baserect[0]+self.baserect[2]+50
|
||||||
py = self.rect[1]+self.rect[3]/2-txt.get_height()/2-game.globals["camerax"]
|
py = self.rect[1]+self.rect[3]/2-txt.get_height()/2
|
||||||
game.window.blit(txt,[px,py])
|
game.window.blit(txt,[px,py])
|
||||||
|
@ -32,7 +32,8 @@ def ingame(game):
|
|||||||
game.gameloop.summon(Manager(game))
|
game.gameloop.summon(Manager(game))
|
||||||
|
|
||||||
def options(game):
|
def options(game):
|
||||||
game.gameloop.reinit()
|
game.gameloop.delname("Button")
|
||||||
|
game.gameloop.delname("MainMenu")
|
||||||
game.globals["camerax"] = 0
|
game.globals["camerax"] = 0
|
||||||
game.globals["cameray"] = 0
|
game.globals["cameray"] = 0
|
||||||
s = BGMSlider(40,40,game,400,40)
|
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))
|
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(menu)
|
||||||
|
|
||||||
def gameover(game):
|
def gameover(game):
|
||||||
game.gameloop.reinit()
|
game.gameloop.reinit()
|
||||||
|
Loading…
Reference in New Issue
Block a user