from gamedata.objects.base import BaseObject import math class Demo(BaseObject): def __init__(self,game): super().__init__(game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT/2,game,0,0) self.blinktimer = game.lib.Timer(0.5) self.maxblink = 6 self.depth = 6 def step(self): self.blinktimer.tick(self.game.dt) if self.blinktimer.getloops()>=self.maxblink: self.game.gameloop.delid(self.id) def draw(self): sprites = self.game.getSpriteDir("cursor/") sprite = sprites[self.blinktimer.getloops()%2] if self.blinktimer.getloops()>=self.maxblink-1: sprite.set_alpha(self.blinktimer.getratio()*255) elif self.blinktimer.getloops()==0: sprite.set_alpha((1-self.blinktimer.getratio())*255) else: sprite.set_alpha(255) if self.blinktimer.getloops()