Added optional end of game cut scene. Make sure to specify utf-8 encoding for python files to work with pyinstaller.
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.object import Object
|
from src.object import Object
|
||||||
import random
|
import random
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.item_types import ItemProperties
|
from src.item_types import ItemProperties
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.object import Object
|
from src.object import Object
|
||||||
from src.powerup import PowerUp
|
from src.powerup import PowerUp
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
import pygame
|
import pygame
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.object import Object
|
from src.object import Object
|
||||||
from src.powerup import PowerUp
|
from src.powerup import PowerUp
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import random
|
import random
|
||||||
from enum import Enum, auto
|
from enum import Enum, auto
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
import random
|
import random
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
|
|
||||||
class Object:
|
class Object:
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import pygame
|
import pygame
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.stat_tracker import StatTracker
|
from src.stat_tracker import StatTracker
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.object import Object
|
from src.object import Object
|
||||||
from src.weapon import Weapon
|
from src.weapon import Weapon
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Projectile:
|
class Projectile:
|
||||||
def __init__(self, projectile_type, start_x, direction):
|
def __init__(self, projectile_type, start_x, direction):
|
||||||
self.type = projectile_type
|
self.type = projectile_type
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
from src.object import Object
|
from src.object import Object
|
||||||
|
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class StatTracker:
|
class StatTracker:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
# Base dictionary for tracking stats
|
# Base dictionary for tracking stats
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
class Weapon:
|
class Weapon:
|
||||||
def __init__(self, name, damage, range, attackSound, hitSound, cooldown=500, attackDuration=200):
|
def __init__(self, name, damage, range, attackSound, hitSound, cooldown=500, attackDuration=200):
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|||||||
+11
-1
@@ -1,4 +1,6 @@
|
|||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
from libstormgames import *
|
from libstormgames import *
|
||||||
@@ -56,7 +58,6 @@ class WickedQuest:
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
speak("Level not found")
|
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def handle_input(self):
|
def handle_input(self):
|
||||||
@@ -272,6 +273,15 @@ class WickedQuest:
|
|||||||
# Game complete - use gameStartTime for total
|
# Game complete - use gameStartTime for total
|
||||||
totalTime = pygame.time.get_ticks() - self.gameStartTime
|
totalTime = pygame.time.get_ticks() - self.gameStartTime
|
||||||
if self.player.xPos >= self.currentLevel.rightBoundary:
|
if self.player.xPos >= self.currentLevel.rightBoundary:
|
||||||
|
# Check for end of game scene
|
||||||
|
gamePath = os.path.dirname(get_level_path(self.currentGame, 1))
|
||||||
|
for ext in ['.wav', '.ogg', '.mp3']:
|
||||||
|
endFile = os.path.join(gamePath, f'end{ext}')
|
||||||
|
if os.path.exists(endFile):
|
||||||
|
self.sounds['end_scene'] = pygame.mixer.Sound(endFile)
|
||||||
|
cut_scene(self.sounds, 'end_scene')
|
||||||
|
break
|
||||||
|
else:
|
||||||
messagebox("Congratulations! You've completed all available levels!")
|
messagebox("Congratulations! You've completed all available levels!")
|
||||||
|
|
||||||
self.display_game_over(totalTime)
|
self.display_game_over(totalTime)
|
||||||
|
|||||||
Reference in New Issue
Block a user