25 lines
715 B
Python
25 lines
715 B
Python
|
from gamedata.objects.base import BaseObject
|
||
|
|
||
|
class Ripple(BaseObject):
|
||
|
|
||
|
def __init__(self,x,y,game,nodes,customvalues):
|
||
|
|
||
|
super().__init__(x,y,game)
|
||
|
|
||
|
self.sprites = self.game.getSpriteDir("ripple/")
|
||
|
self.sprite = self.sprites[0]
|
||
|
|
||
|
self.rect[2],self.rect[3] = self.sprite.get_size()
|
||
|
|
||
|
self.spriteindex = game.lib.randint(0,len(self.sprites)-1)
|
||
|
self.animspeed = 4
|
||
|
|
||
|
def step(self):
|
||
|
|
||
|
self.spriteindex+=self.animspeed*self.game.dt
|
||
|
self.sprite = self.sprites[int(self.spriteindex)%len(self.sprites)]
|
||
|
|
||
|
def draw(self):
|
||
|
|
||
|
self.game.window.blit(self.sprite,[self.rect[0]-self.game.globals["camerax"],self.rect[1]-self.game.globals["cameray"]])
|