forked from ayte/PinmikPanik
26 lines
816 B
Python
26 lines
816 B
Python
from gamedata.objects.base import BaseObject
|
|
|
|
class MenuBackground(BaseObject):
|
|
|
|
def __init__(self,game):
|
|
super().__init__(0,0,game,game.DISPLAY_WIDTH,game.DISPLAY_HEIGHT)
|
|
|
|
# Islands
|
|
self.sprite = game.sprite_lib["ingame.png"]
|
|
|
|
self.depth = -2
|
|
|
|
self.cameraratio = 0.1
|
|
|
|
|
|
def step(self):
|
|
game = self.game
|
|
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
|
|
|
|
def draw(self):
|
|
game = self.game
|
|
game.window.blit(self.sprite,[-game.globals["camerax"]*self.cameraratio,-game.globals["cameray"]*self.cameraratio])
|