Fixed screen shake

This commit is contained in:
theo@manjaro 2021-09-15 21:14:53 +02:00
parent afb9425069
commit 3268737075
1 changed files with 6 additions and 3 deletions

View File

@ -7,7 +7,6 @@ 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(20,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
@ -93,8 +92,12 @@ class Lemming(BaseObject):
dead = False dead = False
if dead: if dead:
self.manager.death() self.manager.death()
self.game.globals["scamerax"]+=5 if self.game.globals["scamerax"]*self.game.globals["scameray"]>5: # Avoiding shaking to much
self.game.globals["scameray"]+=5 self.game.globals["scamerax"]+=1
self.game.globals["scamerax"]+=1
else:
self.game.globals["scamerax"]=5
self.game.globals["scameray"]=5
self.game.gameloop.delid(self.id) self.game.gameloop.delid(self.id)
# Spawn particles # Spawn particles