2021-09-18 17:34:46 +02:00
|
|
|
from gamedata.objects.base import BaseObject
|
|
|
|
import random
|
|
|
|
|
|
|
|
class FallingPinmik(BaseObject):
|
|
|
|
|
2021-09-18 18:03:04 +02:00
|
|
|
def __init__(self,game,skins=["base","green"]):
|
2021-09-18 17:34:46 +02:00
|
|
|
|
|
|
|
x = random.randint(0,game.DISPLAY_WIDTH)
|
|
|
|
y = -30
|
|
|
|
|
|
|
|
super().__init__(x,y,game,0,0)
|
|
|
|
|
|
|
|
self.cameraratio = random.random()*0.1+0.05
|
|
|
|
|
2021-09-18 18:03:04 +02:00
|
|
|
self.sprite = game.sprite_lib["lemmings/"+random.choice(skins)+"/falling.png"]
|
2021-09-18 17:34:46 +02:00
|
|
|
|
|
|
|
self.offset = 0
|
|
|
|
self.speed = 100*(0.30-self.cameraratio)/0.30
|
|
|
|
|
|
|
|
self.depth = -1.5
|
|
|
|
|
|
|
|
def step(self):
|
|
|
|
|
|
|
|
self.offset+=self.game.dt*self.speed
|
|
|
|
|
|
|
|
def draw(self):
|
|
|
|
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0]-self.game.globals["camerax"]*self.cameraratio,self.rect[1]+self.offset-self.game.globals["cameray"]*self.cameraratio)
|