Added more pinmiks on game start

This commit is contained in:
theo@manjaro 2021-09-17 15:09:01 +02:00
parent 59a7b97b94
commit 09eef1ae4d
4 changed files with 7 additions and 11 deletions

View File

@ -8,24 +8,17 @@ class Demo(BaseObject):
super().__init__(game.DISPLAY_WIDTH/2,game.DISPLAY_HEIGHT/2,game,0,0)
self.blinktimer = game.lib.Timer(0.5)
self.pinmik = game.gameloop.findname("Lemming")[0]
self.move()
self.maxblink = 6
self.depth = 6
def move(self):
self.rect[0] = self.pinmik.rect.center[0]
self.rect[1] = self.pinmik.rect.center[1]+50
def step(self):
self.blinktimer.tick(self.game.dt)
if self.blinktimer.getloops()>=self.maxblink:
self.game.gameloop.delid(self.id)
self.move()
def draw(self):
sprites = self.game.getSpriteDir("cursor/")
@ -37,4 +30,5 @@ class Demo(BaseObject):
else:
sprite.set_alpha(255)
if self.blinktimer.getloops()<self.maxblink:
self.game.lib.drawcenter(self.game,sprite,self.rect[0],self.rect[1])
for pinmik in self.game.gameloop.findname("Lemming"):
self.game.lib.drawcenter(self.game,sprite,pinmik.rect.center[0],pinmik.rect.center[1]+50)

View File

@ -36,7 +36,9 @@ class Manager(BaseObject):
# Summon the tiles
self.tiles = Tiles(288,0,game)
game.gameloop.summon(self.tiles)
# Spawn the first one
# Spawn the first batch
self.game.gameloop.summon(Spawner(self.game,self.tiles))
self.game.gameloop.summon(Spawner(self.game,self.tiles))
self.game.gameloop.summon(Spawner(self.game,self.tiles))
# Demo

View File

@ -11,7 +11,7 @@ class Spawner(BaseObject):
self.speedmargin = speedmargin
self.fallsprite = game.sprite_lib["lemmings/falling.png"]
self.distance = game.DISPLAY_HEIGHT
self.timer = game.lib.Timer(3) # Seconds of telegraph before spawning the lemming
self.timer = game.lib.Timer(2.5+random.random()) # Seconds of telegraph before spawning the lemming
def step(self):
if self.timer.tick(self.game.dt):

View File

@ -13,7 +13,7 @@ class Tiles(BaseObject):
self.nbcells = nbcells
self.cellsize = cellsize
self.saferadius = 2
self.saferadius = 3
self.grid = self.gengrid(game.sprite_lib["collisionmap.png"])
self.spawns = self.getspawnpoints(self.grid,saferadius=self.saferadius)