Added end cinematic

This commit is contained in:
theo@manjaro 2021-11-28 11:33:00 +01:00
parent 50887b4c02
commit d9158b1dbc
27 changed files with 6478 additions and 16 deletions

View File

@ -3,6 +3,7 @@
## Musics
- Overworld : Kevin MacLeod - Itty Bitty 8 Bit
- Level 1 : Jeremy Blake - Powerup
- Level 2 : Quincas Moreira - Robot City
- Level 3 : Kubbi - Up In My Jam
- Level 1 & 6 : Jeremy Blake - Powerup
- Level 2 & 5 : Quincas Moreira - Robot City
- Level 3 & 4 : Kubbi - Up In My Jam
- Intro and ending : The Whole Other - 8-Bit Dreamscape

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

View File

@ -91,6 +91,11 @@ class Game():
self.globals["finishedlevels"] = [] # Levels where the player went to the end
self.globals["completedlevels"] = [] # Levels where the player kicked all non-respawnable ennemies
self.globals["speedrunlevels"] = [] # Levels where the player finished fast enough
self.globals["speedrunlevels"] = list(range(5))
self.globals["completedlevels"] = list(range(5))
self.globals["overworld"] = True
self.globals["nblevels"] = 0
self.globals["levelname"] = None
self.globals["allunlocked"] = True
self.globals["bgms"] = ["city.ogg","docks.ogg","isle.ogg","isle.ogg","docks.ogg","city.ogg"]
self.init_inputs()

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

File diff suppressed because it is too large Load Diff

View File

@ -7,6 +7,9 @@ class Cinematic(BaseObject):
super().__init__(0,0,game)
self.bgm = self.game.sound_lib["bgm/cinematic.ogg"]
self.bgm.play()
text = """More and more trash is being thrown away
It's up to you now to clean everything up
Watch out for the baddies !"""
@ -44,6 +47,10 @@ Watch out for the baddies !"""
t = Transition(self.game)
self.game.gameloop.summon(t)
self.sfx.play()
self.bgm.stop()
if self.game.inputs["keys"]["up"]["timer"]==1:
self.timer.timer = 0
def draw(self):

View File

@ -0,0 +1,87 @@
from gamedata.objects.base import BaseObject
from gamedata.objects.transition import Transition
class EndCinematic(BaseObject):
def __init__(self,game):
super().__init__(0,0,game)
clean = len(game.globals["completedlevels"])==self.game.globals["nblevels"]
speedrun = len(game.globals["speedrunlevels"])==self.game.globals["nblevels"]
self.bgm = self.game.sound_lib["bgm/cinematic.ogg"]
self.bgm.play()
self.game.globals["levelname"]=None
text = """Good job finishing all those levels !
But there's some trash left
Try cleaning everything up !"""
if clean:
text = """Thanks for cleaning everything !
Try to beat every level as fast as you can !"""
if speedrun:
text = """You were quick !
But there's some trash left
Try cleaning everything up !"""
if speedrun and clean:
text = """Good job completing the game !
You truly are amazing !"""
text+="""
Made by @justayte for the #Seajam
Go support #TeamSeas"""
self.lines = text.split("\n")
self.sprites = []
for i in self.lines:
self.sprites.append(game.getchars(i))
self.currentlines = 1
self.timer = game.lib.Timer(4)
self.textpadding = 10
self.depth = 2
self.fill = game.pygame.Surface([self.game.globals["cameraw"],self.game.globals["camerah"]])
self.fill.fill([62,33,55])
self.totalheight = len(self.lines)*9+(len(self.lines)-1)*self.textpadding
self.offset = (self.game.globals["camerah"]-self.totalheight)/2
self.title = self.game.sprite_lib["title.png"]
self.sfx = self.game.sound_lib["sfx/return.wav"]
def step(self):
if self.currentlines < len(self.lines)+2 and self.timer.tick(self.game.dt):
self.currentlines += 1
if self.currentlines == len(self.lines):
self.timer = self.game.lib.Timer(5)
elif self.currentlines == len(self.lines)+2:
# Spawn transition
t = Transition(self.game)
self.game.gameloop.summon(t)
self.sfx.play()
self.bgm.stop()
if self.game.inputs["keys"]["up"]["timer"]==1:
self.timer.timer = 0
def draw(self):
self.game.window.blit(self.fill,[0,0])
if self.currentlines<=len(self.lines):
for i in range(self.currentlines):
cx = self.game.globals["cameraw"]/2
self.game.lib.drawcenter(self.game,self.sprites[i],cx,self.offset+i*(self.textpadding+9))
else:
cx = self.game.globals["cameraw"]/2
cy = self.game.globals["camerah"]/2
self.game.lib.drawcenter(self.game,self.title,cx,cy)

View File

@ -81,7 +81,7 @@ class TilesetRenderer(BaseObject):
self.layers = []
self.spawns = []
self.bgm = None
if "levelname" in self.game.globals.keys():
if self.game.globals["levelname"]!=None and not self.game.globals["overworld"]:
self.bgm = self.game.sound_lib["bgm/"+self.game.globals["bgms"][self.game.globals["levelname"]]]
if self.bgm:
self.bgm.play(-1)

View File

@ -10,6 +10,7 @@ class Levels(BaseObject):
for i in nodes:
self.nodes.append(i.copy())
self.customvalues = customvalues
self.game.globals["nblevels"] = len(self.nodes)
self.bgm = self.game.sound_lib["bgm/overworld.ogg"]
self.bgm.play(-1)
@ -55,7 +56,7 @@ class Levels(BaseObject):
self.animspeed = 7
self.cursor = 0
if "levelname" in self.game.globals.keys():
if self.game.globals["levelname"]!=None:
self.cursor = self.game.globals["levelname"] # Which level is selected
self.playerx = self.nodes[self.cursor]["x"]
self.playery = self.nodes[self.cursor]["y"]

View File

@ -11,6 +11,8 @@ class Results(BaseObject):
self.currentcount = 0
self.count = self.game.globals["trashes"]
self.lastlevel = self.game.globals["nblevels"]-1==self.game.globals["levelname"]
self.maxtime = self.game.globals["timetobeat"]
self.currenttime = 99
self.time = min(99,self.game.globals["timer"])
@ -81,7 +83,7 @@ class Results(BaseObject):
for i in keys:
self.transition = self.transition or self.game.inputs["keys"][i]["timer"]==1
if self.transition:
t = Transition(self.game)
t = Transition(self.game,endcinematic=self.lastlevel)
self.game.gameloop.summon(t)
self.backsfx.play()

View File

@ -2,7 +2,7 @@ from gamedata.objects.base import BaseObject
class Transition(BaseObject):
def __init__(self,game,time=0.7,holdtime=0,level=None):
def __init__(self,game,time=0.7,holdtime=0,level=None,endcinematic=False):
super().__init__(0,0,game)
@ -11,6 +11,8 @@ class Transition(BaseObject):
self.surface.fill(self.color)
self.level = level
self.endcinematic = endcinematic
self.timer = game.lib.Timer(time)
self.holdtimer = game.lib.Timer(holdtime)
self.hold = False
@ -29,10 +31,16 @@ class Transition(BaseObject):
self.alpha = 255
else:
if self.holdtimer.tick(self.game.dt):
if not self.endcinematic:
if self.level:
self.game.globals["overworld"] = False
self.game.scenes.ingame(self.game,level = self.level)
else:
self.game.globals["overworld"] = True
self.game.scenes.overworld(self.game)
else:
self.game.scenes.end(self.game)
self.game.globals["pause"] = False

View File

@ -3,6 +3,7 @@ from gamedata.objects.ingame.tileset import TilesetRenderer
from gamedata.objects.ingame.water import Water
from gamedata.objects.results import Results
from gamedata.objects.cinematic import Cinematic
from gamedata.objects.endcinematic import EndCinematic
def ingame(game,level="Level 2"):
game.globals["camerax"] = 0
@ -26,3 +27,8 @@ def boot(game):
game.scaleCamera(416,234)
c = Cinematic(game)
game.gameloop.summon(c)
def end(game):
game.gameloop.reinit()
c = EndCinematic(game)
game.gameloop.summon(c)

Binary file not shown.