Overflown/gamedata/objects/bg/menubackground.py

24 lines
937 B
Python
Raw Normal View History

2021-06-25 14:42:35 +02:00
from gamedata.objects.bg.backgrounddrawer import BackgroundDrawer
class MenuBackground(BackgroundDrawer):
def __init__(self,game):
super().__init__(0,0,game,game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT,game.sprite_lib["grid.png"],0.025)
# Initialise son sprite
shadow = game.sprite_lib["shadow.png"]
self.shadow = game.pygame.transform.scale(shadow,(1500,1500)) # J'augmente la taille de l'ombre
2021-06-25 16:13:52 +02:00
def step(self):
game = self.game
super().step()
2021-06-25 14:42:35 +02:00
destx = (game.inputs["mouse"]["pos"][0]-game.DISPLAY_WIDTH/2)
desty = (game.inputs["mouse"]["pos"][1]-game.DISPLAY_HEIGHT/2)
game.globals["camerax"] += (destx-game.globals["camerax"])/6
game.globals["cameray"] += (desty-game.globals["cameray"])/6
2021-06-25 16:13:52 +02:00
def draw(self):
game = self.game
super().draw()
2021-06-25 14:42:35 +02:00
game.lib.drawcenter(game,self.shadow,game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT*3/5)