forked from ayte/PinmikPanik
Fixed speed variation
This commit is contained in:
parent
7930b72fc8
commit
afb9425069
@ -7,8 +7,9 @@ class Lemming(BaseObject):
|
|||||||
self.direction = random.randint(0,360)
|
self.direction = random.randint(0,360)
|
||||||
self.holdrect = self.rect.copy()
|
self.holdrect = self.rect.copy()
|
||||||
self.holdradius = 80
|
self.holdradius = 80
|
||||||
|
print(speedmargin)
|
||||||
self.holdrect = self.holdrect.inflate(self.holdradius,self.holdradius)
|
self.holdrect = self.holdrect.inflate(self.holdradius,self.holdradius)
|
||||||
self.basespeed = max(30,40+random.randint(-speedmargin,speedmargin)) # Speed that he normally walks by
|
self.basespeed = max(20,40+random.randint(-speedmargin,speedmargin)) # Speed that he normally walks by
|
||||||
self.holdtimer = game.lib.Timer(2.5) # Max seconds of holding
|
self.holdtimer = game.lib.Timer(2.5) # Max seconds of holding
|
||||||
self.normalspeed = self.basespeed # Speed "objective"
|
self.normalspeed = self.basespeed # Speed "objective"
|
||||||
self.speed = 0 # Current speed, leaning towards objective speed
|
self.speed = 0 # Current speed, leaning towards objective speed
|
||||||
|
@ -12,7 +12,7 @@ class Manager(BaseObject):
|
|||||||
self.basetime = 10
|
self.basetime = 10
|
||||||
self.steptime = 2
|
self.steptime = 2
|
||||||
self.speedmargin = 7
|
self.speedmargin = 7
|
||||||
self.stepmargin = 2
|
self.speedstep = 2.2
|
||||||
self.spawntimer = game.lib.Timer(self.basetime) # Time elapsing each lemming spawn
|
self.spawntimer = game.lib.Timer(self.basetime) # Time elapsing each lemming spawn
|
||||||
self.deathtimer = game.lib.Timer(1) # Time between each life loss
|
self.deathtimer = game.lib.Timer(1) # Time between each life loss
|
||||||
self.started = False
|
self.started = False
|
||||||
@ -47,6 +47,7 @@ class Manager(BaseObject):
|
|||||||
if (self.lives>0 and nblemmings>0):
|
if (self.lives>0 and nblemmings>0):
|
||||||
if self.spawntimer.tick(self.game.dt):
|
if self.spawntimer.tick(self.game.dt):
|
||||||
self.game.gameloop.summon(Spawner(self.game,self.tiles,speedmargin=int(self.speedmargin+0.5)))
|
self.game.gameloop.summon(Spawner(self.game,self.tiles,speedmargin=int(self.speedmargin+0.5)))
|
||||||
|
self.speedmargin+=self.speedstep
|
||||||
self.spawntimer = self.game.lib.Timer(self.basetime+nblemmings*self.steptime)
|
self.spawntimer = self.game.lib.Timer(self.basetime+nblemmings*self.steptime)
|
||||||
else:
|
else:
|
||||||
# Game over
|
# Game over
|
||||||
|
Loading…
Reference in New Issue
Block a user