forked from ayte/PinmikPanik
Added more speedvariation
This commit is contained in:
parent
6288826675
commit
70b1f0760d
@ -8,7 +8,7 @@ class Lemming(BaseObject):
|
||||
self.holdrect = self.rect.copy()
|
||||
self.holdradius = 65
|
||||
self.holdrect = self.holdrect.inflate(self.holdradius,self.holdradius)
|
||||
self.basespeed = 40+random.randint(-speedmargin,speedmargin) # Speed that he normally walks by
|
||||
self.basespeed = max(30,40+random.randint(-speedmargin,speedmargin)) # Speed that he normally walks by
|
||||
self.holdtimer = game.lib.Timer(2.5) # Max seconds of holding
|
||||
self.normalspeed = self.basespeed # Speed "objective"
|
||||
self.speed = 0 # Current speed, leaning towards objective speed
|
||||
|
@ -9,6 +9,8 @@ class Manager(BaseObject):
|
||||
self.lives = 5
|
||||
self.basetime = 10
|
||||
self.steptime = 2
|
||||
self.speedmargin = 6
|
||||
self.stepmargin = 0.4
|
||||
self.spawntimer = game.lib.Timer(self.basetime) # Time elapsing each lemming spawn
|
||||
self.scoreratio = 0.4 # Points earned per seconds and per lemming
|
||||
|
||||
@ -23,9 +25,10 @@ class Manager(BaseObject):
|
||||
for i in self.game.gameloop.findname("Lemming"):
|
||||
self.score+=self.scoreratio*self.game.dt
|
||||
if self.spawntimer.tick(self.game.dt):
|
||||
self.game.gameloop.summon(Spawner(self.game,self.tiles))
|
||||
self.game.gameloop.summon(Spawner(self.game,self.tiles,speedmargin=int(self.speedmargin+0.5)))
|
||||
self.basetime+=self.steptime
|
||||
self.spawntimer = self.game.lib.Timer(self.basetime)
|
||||
self.speedmargin+=self.stepmargin
|
||||
|
||||
def draw(self):
|
||||
pass
|
||||
|
@ -4,15 +4,16 @@ from gamedata.objects.ingame.lemmings import Lemming
|
||||
import random
|
||||
|
||||
class Spawner(BaseObject):
|
||||
def __init__(self,game,tiles):
|
||||
def __init__(self,game,tiles,speedmargin=5):
|
||||
spawnpoint = random.choice(tiles.spawns)
|
||||
super().__init__(spawnpoint[0],spawnpoint[1],game)
|
||||
self.sprite = game.sprite_lib["lemmings/shadow.png"]
|
||||
self.speedmargin = speedmargin
|
||||
self.timer = game.lib.Timer(3) # Seconds of telegraph before spawning the lemming
|
||||
|
||||
def step(self):
|
||||
if self.timer.tick(self.game.dt):
|
||||
lemming = Lemming(self.rect[0],self.rect[1],self.game)
|
||||
lemming = Lemming(self.rect[0],self.rect[1],self.game,speedmargin=self.speedmargin)
|
||||
lemming.move(-lemming.rect[2]/2,-lemming.rect[3]/2)
|
||||
self.game.gameloop.summon(lemming)
|
||||
self.game.gameloop.delid(self.id)
|
||||
|
Loading…
Reference in New Issue
Block a user