Added hold indicator

This commit is contained in:
theo@manjaro 2021-09-15 20:34:48 +02:00
parent 3a72856436
commit 75ee59d0c7
4 changed files with 5 additions and 3 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 666 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 55 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@ -3,10 +3,10 @@ import random,math
class Lemming(BaseObject):
def __init__(self,x,y,game,speedmargin=5):
super().__init__(x,y,game,w=60,h=60)
super().__init__(x,y,game,w=70,h=70)
self.direction = random.randint(0,360)
self.holdrect = self.rect.copy()
self.holdradius = 65
self.holdradius = 80
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.holdtimer = game.lib.Timer(2.5) # Max seconds of holding
@ -16,7 +16,7 @@ class Lemming(BaseObject):
self.selected = False # If beeing redirected
self.cachedrel = [] # Storing relative movement of mouse
self.cachedrelsize = 10
self.mincachedsize = 5
self.mincachedsize = 3
# Used for movement
self.restx = 0
@ -128,6 +128,8 @@ class Lemming(BaseObject):
sprites = self.sprites[orientation]
self.game.lib.drawcenter(self.game,self.game.sprite_lib["lemmings/shadow.png"],self.rect.center[0]-self.game.globals["camerax"],self.rect.center[1]-self.game.globals["cameray"])
self.game.lib.drawcenter(self.game,sprites[int(self.spriteindex)%len(sprites)],self.rect.center[0]-self.game.globals["camerax"],self.rect.center[1]-self.game.globals["cameray"])
if self.selected:
self.game.lib.drawcenter(self.game,self.game.sprite_lib["lemmings/selected.png"],self.rect.center[0]-self.game.globals["camerax"],self.rect.center[1]-self.game.globals["cameray"])
if self.game.globals["debug"]:
s = self.game.pygame.Surface(self.rect.size)
s.fill([255,0,0])