diff --git a/gamedata/assets/lemmings/Left/0.png b/gamedata/assets/lemmings/Left/0.png new file mode 100644 index 0000000..d87cc55 Binary files /dev/null and b/gamedata/assets/lemmings/Left/0.png differ diff --git a/gamedata/assets/lemmings/Left/1.png b/gamedata/assets/lemmings/Left/1.png new file mode 100644 index 0000000..314eac9 Binary files /dev/null and b/gamedata/assets/lemmings/Left/1.png differ diff --git a/gamedata/assets/lemmings/Left/2.png b/gamedata/assets/lemmings/Left/2.png new file mode 100644 index 0000000..e44bb5c Binary files /dev/null and b/gamedata/assets/lemmings/Left/2.png differ diff --git a/gamedata/assets/lemmings/Left/3.png b/gamedata/assets/lemmings/Left/3.png new file mode 100644 index 0000000..e03d204 Binary files /dev/null and b/gamedata/assets/lemmings/Left/3.png differ diff --git a/gamedata/assets/lemmings/Right/0.png b/gamedata/assets/lemmings/Right/0.png new file mode 100644 index 0000000..0d5c43c Binary files /dev/null and b/gamedata/assets/lemmings/Right/0.png differ diff --git a/gamedata/assets/lemmings/Right/1.png b/gamedata/assets/lemmings/Right/1.png new file mode 100644 index 0000000..e8f06a3 Binary files /dev/null and b/gamedata/assets/lemmings/Right/1.png differ diff --git a/gamedata/assets/lemmings/Right/2.png b/gamedata/assets/lemmings/Right/2.png new file mode 100644 index 0000000..0120ed3 Binary files /dev/null and b/gamedata/assets/lemmings/Right/2.png differ diff --git a/gamedata/assets/lemmings/Right/3.png b/gamedata/assets/lemmings/Right/3.png new file mode 100644 index 0000000..8e2c267 Binary files /dev/null and b/gamedata/assets/lemmings/Right/3.png differ diff --git a/gamedata/objects/ingame/lemmings.py b/gamedata/objects/ingame/lemmings.py index e996970..17731e3 100644 --- a/gamedata/objects/ingame/lemmings.py +++ b/gamedata/objects/ingame/lemmings.py @@ -20,6 +20,14 @@ class Lemming(BaseObject): self.restx = 0 self.resty = 0 + # Sprites + self.orientations = ["Right","Left","Left","Right"] + self.sprites = {} + for i in self.orientations: + self.sprites[i] = game.getSpriteDir("lemmings/"+i+"/") + self.spriteindex = 0 + self.animspeed = 0.2 + def step(self): # Lean towards the normal speed @@ -50,6 +58,9 @@ class Lemming(BaseObject): if distance<=self.radius: self.selected = True + # Animation + self.spriteindex+=self.game.dt*self.animspeed*self.speed + def launch(self): # Launch itself in the mouse direction if len(self.cachedrel)>self.mincachedsize: @@ -68,3 +79,8 @@ class Lemming(BaseObject): self.resty = vely-int(vely) self.rect[0]+=int(velx) self.rect[1]+=int(vely) + + def draw(self): + orientation = self.orientations[int(self.direction%360/361*4)] + sprites = self.sprites[orientation] + self.game.lib.drawcenter(self.game,sprites[int(self.spriteindex)%len(sprites)],self.rect.center[0],self.rect.center[1])