Compare commits

...

2 Commits

Author SHA1 Message Date
theo@manjaro 53b81bb48c Added color variations 2021-09-18 18:03:04 +02:00
theo@manjaro 32467d017d Added falling pinmiks on menu 2021-09-18 17:34:46 +02:00
22 changed files with 50 additions and 6 deletions

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 11 KiB

After

Width:  |  Height:  |  Size: 11 KiB

View File

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 10 KiB

View File

Before

Width:  |  Height:  |  Size: 825 B

After

Width:  |  Height:  |  Size: 825 B

View File

Before

Width:  |  Height:  |  Size: 831 B

After

Width:  |  Height:  |  Size: 831 B

View File

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 813 B

View File

Before

Width:  |  Height:  |  Size: 859 B

After

Width:  |  Height:  |  Size: 859 B

View File

Before

Width:  |  Height:  |  Size: 844 B

After

Width:  |  Height:  |  Size: 844 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

View File

@ -1,4 +1,6 @@
from gamedata.objects.base import BaseObject
from gamedata.objects.fallingpinmik import FallingPinmik
import random
class MenuBackground(BaseObject):
@ -7,11 +9,14 @@ class MenuBackground(BaseObject):
# Islands
self.sprite = game.sprite_lib["islands.png"]
self.depth = -2
self.cameraratio = 0.1
# Pinmik falling
self.pinmiktimer = game.lib.Timer(1)
def step(self):
game = self.game
@ -20,6 +25,10 @@ class MenuBackground(BaseObject):
game.globals["camerax"] += (destx-game.globals["camerax"])/6
game.globals["cameray"] += (desty-game.globals["cameray"])/6
if self.pinmiktimer.tick(self.game.dt):
self.pinmiktimer = game.lib.Timer(1+random.random())
self.game.gameloop.summon(FallingPinmik(game))
def draw(self):
game = self.game
game.window.blit(self.sprite,[-game.globals["camerax"]*self.cameraratio,-game.globals["cameray"]*self.cameraratio])

View File

@ -0,0 +1,27 @@
from gamedata.objects.base import BaseObject
import random
class FallingPinmik(BaseObject):
def __init__(self,game,skins=["base","green"]):
x = random.randint(0,game.DISPLAY_WIDTH)
y = -30
super().__init__(x,y,game,0,0)
self.cameraratio = random.random()*0.1+0.05
self.sprite = game.sprite_lib["lemmings/"+random.choice(skins)+"/falling.png"]
self.offset = 0
self.speed = 100*(0.30-self.cameraratio)/0.30
self.depth = -1.5
def step(self):
self.offset+=self.game.dt*self.speed
def draw(self):
self.game.lib.drawcenter(self.game,self.sprite,self.rect[0]-self.game.globals["camerax"]*self.cameraratio,self.rect[1]+self.offset-self.game.globals["cameray"]*self.cameraratio)

View File

@ -2,7 +2,7 @@ from gamedata.objects.base import BaseObject
import random,math
class Lemming(BaseObject):
def __init__(self,x,y,game,speedmargin=5):
def __init__(self,x,y,game,speedmargin=5,skin="base"):
super().__init__(x,y,game,w=70,h=70)
self.direction = random.randint(0,360)
self.holdrect = self.rect.copy()
@ -13,6 +13,8 @@ class Lemming(BaseObject):
self.normalspeed = self.basespeed # Speed "objective"
self.speed = 0 # Current speed, leaning towards objective speed
self.skin = skin
self.selected = False # If beeing redirected
self.anglemargin = 25
@ -27,7 +29,7 @@ class Lemming(BaseObject):
self.orientations = ["Right","Left","Left","Right"]
self.sprites = {}
for i in self.orientations:
self.sprites[i] = game.getSpriteDir("lemmings/"+i+"/")
self.sprites[i] = game.getSpriteDir("lemmings/"+skin+"/"+i+"/")
self.spriteindex = 0
self.animspeed = 0.2

View File

@ -4,18 +4,24 @@ from gamedata.objects.ingame.lemmings import Lemming
import random
class Spawner(BaseObject):
def __init__(self,game,tiles,speedmargin=5):
def __init__(self,game,tiles,speedmargin=5,skins={"normal":["base","green"],"specials":[]}):
spawnpoint = random.choice(tiles.spawns)
super().__init__(spawnpoint[0],spawnpoint[1],game)
self.sprite = game.sprite_lib["lemmings/shadow.png"].copy()
self.speedmargin = speedmargin
self.fallsprite = game.sprite_lib["lemmings/falling.png"]
self.distance = game.DISPLAY_HEIGHT
self.timer = game.lib.Timer(2.5+random.random()) # Seconds of telegraph before spawning the lemming
# Skin choosing
self.skin = random.choice(skins["normal"])
if random.randint(1,10)==1: # 1/10 chance to have a special
if len(skins["specials"])>0:
self.skin = random.choice(skins["specials"])
self.fallsprite = game.sprite_lib["lemmings/"+self.skin+"/falling.png"]
def step(self):
if self.timer.tick(self.game.dt):
lemming = Lemming(self.rect[0],self.rect[1],self.game,speedmargin=self.speedmargin)
lemming = Lemming(self.rect[0],self.rect[1],self.game,speedmargin=self.speedmargin,skin=self.skin)
lemming.move(-lemming.rect[2]/2,-lemming.rect[3]/2)
self.game.gameloop.summon(lemming)
self.game.gameloop.delid(self.id)