Added pause menu
BIN
gamedata/assets/lemmings/monster/Left/0.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Left/1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Left/2.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Left/3.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/monster/Right/0.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Right/1.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Right/2.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/monster/Right/3.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/monster/falling.png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
gamedata/assets/lemmings/platinum/Left/0.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Left/1.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Left/2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Left/3.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
gamedata/assets/lemmings/platinum/Right/0.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Right/1.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Right/2.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
gamedata/assets/lemmings/platinum/Right/3.png
Normal file
After Width: | Height: | Size: 10 KiB |
BIN
gamedata/assets/lemmings/platinum/falling.png
Normal file
After Width: | Height: | Size: 12 KiB |
@ -136,6 +136,10 @@ def getunlocks(highscore):
|
|||||||
unlocks["normal"].append("green")
|
unlocks["normal"].append("green")
|
||||||
if highscore>=250:
|
if highscore>=250:
|
||||||
unlocks["normal"].append("blue")
|
unlocks["normal"].append("blue")
|
||||||
if highscore>=500:
|
if highscore>=400:
|
||||||
unlocks["specials"].append("gold")
|
unlocks["specials"].append("gold")
|
||||||
|
if highscore>=500:
|
||||||
|
unlocks["specials"].append("monster")
|
||||||
|
if highscore>=750:
|
||||||
|
unlocks["specials"].append("platinum")
|
||||||
return unlocks
|
return unlocks
|
||||||
|
@ -58,6 +58,7 @@ class Game():
|
|||||||
self.globals["scameray"] = 0
|
self.globals["scameray"] = 0
|
||||||
self.globals["debug"] = False
|
self.globals["debug"] = False
|
||||||
self.globals["highscore"] = highscore
|
self.globals["highscore"] = highscore
|
||||||
|
self.globals["pause"] = False
|
||||||
self.scaleCamera()
|
self.scaleCamera()
|
||||||
|
|
||||||
self.globals["bgmvolume"] = bgm
|
self.globals["bgmvolume"] = bgm
|
||||||
|
@ -7,6 +7,7 @@ class BaseObject():
|
|||||||
self.game = game
|
self.game = game
|
||||||
self.sprite = game.sprite_lib["icon.png"]
|
self.sprite = game.sprite_lib["icon.png"]
|
||||||
self.spriteoffset = 0,0
|
self.spriteoffset = 0,0
|
||||||
|
self.handlepause = False
|
||||||
self.depth = 1 # Sa "profondeur", déterminera l'odre d'affichage des objets
|
self.depth = 1 # Sa "profondeur", déterminera l'odre d'affichage des objets
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
|
@ -40,6 +40,7 @@ class GameLoop():
|
|||||||
|
|
||||||
objs = list(self.objects.values())
|
objs = list(self.objects.values())
|
||||||
for i in objs:
|
for i in objs:
|
||||||
|
if i.handlepause and not game.globals["pause"] or not i.handlepause:
|
||||||
i.step()
|
i.step()
|
||||||
|
|
||||||
def draw(self,game):
|
def draw(self,game):
|
||||||
|
@ -11,6 +11,8 @@ class Clouds(BaseObject):
|
|||||||
self.depth = -2
|
self.depth = -2
|
||||||
self.horoffset = 0
|
self.horoffset = 0
|
||||||
|
|
||||||
|
self.handlepause = True
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
self.horoffset+=self.game.dt*self.speed
|
self.horoffset+=self.game.dt*self.speed
|
||||||
|
|
||||||
|
@ -13,10 +13,15 @@ class Lemming(BaseObject):
|
|||||||
self.normalspeed = self.basespeed # Speed "objective"
|
self.normalspeed = self.basespeed # Speed "objective"
|
||||||
self.speed = 0 # Current speed, leaning towards objective speed
|
self.speed = 0 # Current speed, leaning towards objective speed
|
||||||
|
|
||||||
self.scoreratio = 0.2
|
self.handlepause = True
|
||||||
|
|
||||||
|
self.scoreratio = 0.3
|
||||||
if skin=="gold":
|
if skin=="gold":
|
||||||
self.basespeed*=1.2
|
self.basespeed*=1.2
|
||||||
self.scoreratio*=3
|
self.scoreratio*=3
|
||||||
|
if skin=="platinum":
|
||||||
|
self.basespeed*=1.3
|
||||||
|
self.scoreratio*=5
|
||||||
|
|
||||||
self.skin = skin
|
self.skin = skin
|
||||||
|
|
||||||
|
@ -52,8 +52,12 @@ class Manager(BaseObject):
|
|||||||
lemmings = self.game.gameloop.findname("Lemming")
|
lemmings = self.game.gameloop.findname("Lemming")
|
||||||
nblemmings = len(lemmings) + len(self.game.gameloop.findname("Spawner"))
|
nblemmings = len(lemmings) + len(self.game.gameloop.findname("Spawner"))
|
||||||
# Updating score
|
# Updating score
|
||||||
|
if not self.game.globals["pause"]:
|
||||||
for lemming in lemmings:
|
for lemming in lemmings:
|
||||||
self.score+=lemming.scoreratio*self.game.dt
|
self.score+=lemming.scoreratio*self.game.dt
|
||||||
|
# Pausing the game
|
||||||
|
if self.game.inputs["keys"]["escape"]["timer"]==1:
|
||||||
|
self.game.globals["pause"] = not self.game.globals["pause"]
|
||||||
# Spawning more lemmings
|
# Spawning more lemmings
|
||||||
if (self.lives>0 and nblemmings>0):
|
if (self.lives>0 and nblemmings>0):
|
||||||
if self.spawntimer.tick(self.game.dt):
|
if self.spawntimer.tick(self.game.dt):
|
||||||
@ -65,6 +69,7 @@ class Manager(BaseObject):
|
|||||||
if self.endtimer.tick(self.game.dt):
|
if self.endtimer.tick(self.game.dt):
|
||||||
self.game.globals["score"] = int(self.score)
|
self.game.globals["score"] = int(self.score)
|
||||||
self.game.scene = self.game.scenes.gameover
|
self.game.scene = self.game.scenes.gameover
|
||||||
|
self.game.globals["pause"] = False
|
||||||
|
|
||||||
if self.invincible:
|
if self.invincible:
|
||||||
if self.deathtimer.tick(self.game.dt):
|
if self.deathtimer.tick(self.game.dt):
|
||||||
@ -105,9 +110,8 @@ class Manager(BaseObject):
|
|||||||
self.game.realwindow.blit(txtsurfacelives,[20,20*2+txtsurfacescore.get_height()])
|
self.game.realwindow.blit(txtsurfacelives,[20,20*2+txtsurfacescore.get_height()])
|
||||||
|
|
||||||
self.endrect.set_alpha((1-self.endtimer.getratio())*255)
|
self.endrect.set_alpha((1-self.endtimer.getratio())*255)
|
||||||
|
if self.game.globals["pause"]:
|
||||||
|
self.endrect.set_alpha(100)
|
||||||
if self.endtimer.getloops()>=1:
|
if self.endtimer.getloops()>=1:
|
||||||
self.endrect.set_alpha(255)
|
self.endrect.set_alpha(255)
|
||||||
self.game.realwindow.blit(self.endrect,[0,0])
|
self.game.realwindow.blit(self.endrect,[0,0])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -21,6 +21,8 @@ class Skies(BaseObject):
|
|||||||
|
|
||||||
self.blackrectalpha = 0.5
|
self.blackrectalpha = 0.5
|
||||||
|
|
||||||
|
self.handlepause = True
|
||||||
|
|
||||||
def step(self):
|
def step(self):
|
||||||
|
|
||||||
self.timeelapsed+=self.game.dt
|
self.timeelapsed+=self.game.dt
|
||||||
|
@ -12,6 +12,8 @@ class Spawner(BaseObject):
|
|||||||
self.distance = game.DISPLAY_HEIGHT
|
self.distance = game.DISPLAY_HEIGHT
|
||||||
self.timer = game.lib.Timer(2.5+random.random()) # Seconds of telegraph before spawning the lemming
|
self.timer = game.lib.Timer(2.5+random.random()) # Seconds of telegraph before spawning the lemming
|
||||||
|
|
||||||
|
self.handlepause = True
|
||||||
|
|
||||||
# Skin choosing
|
# Skin choosing
|
||||||
self.skin = random.choice(skins["normal"])
|
self.skin = random.choice(skins["normal"])
|
||||||
if random.randint(1,10)==1: # 1/10 chance to have a special
|
if random.randint(1,10)==1: # 1/10 chance to have a special
|
||||||
|