Added game source code and source images
64
BigDict.py
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
BigDict = {"Enemies":{}, "Pickups":{}, "WorldObjects":{}, "Players":{}, "Items":{}}
|
||||||
|
BigDict["Enemies"] = {"Hard":{}, "Medium":{}, "Easy":{}}
|
||||||
|
BigDict["Players"] = {"Unarmed":{}, "Knight":{}, "Ranger":{}, "Mage":{}}
|
||||||
|
BigDict["Pickups"] = {"Weapons":{"Ranged":{}, "Melee":{}, "Magic":{}}}
|
||||||
|
BigDict["WorldObjects"]={"Spawnpoints":[]}
|
||||||
|
#dictionary of enemies
|
||||||
|
BigDict["Enemies"]["Hard"] = {"CastleSlime":["slime00cas", 100, 10, 100, "random"],"LBomb":["bomb", 100, 10, 100, "random"], "SkeletonArcher": ["Skeleton Archer", 100, 15, 100, "range"], "ghost": ["ghost", 100, 20, 150, "chase"]}
|
||||||
|
BigDict["Enemies"]["Medium"] = {"DesertSlime":["slime00des", 100, 7, 75, "random"]}
|
||||||
|
BigDict["Enemies"]["Easy"] = {"Slime":["slime", 100, 5, 50, "random"]}
|
||||||
|
#Order of Attributes: Spritename, health, attack, speed, if follow(AI type)
|
||||||
|
|
||||||
|
#Dictionary of playable characters.
|
||||||
|
BigDict["Players"]["Unarmed"] = ["Unarmed", .75, .75]
|
||||||
|
BigDict["Players"]["Knight"] = ["Knight", 1, .75]
|
||||||
|
BigDict["Players"]["Ranger"] = ["Ranger", .75, 1]
|
||||||
|
BigDict["Players"]["Mage"] = ["Mage", 1, 1]
|
||||||
|
#Order of Attributes: Spritename, health, speed.
|
||||||
|
#health and speed will be multiplied by base class.
|
||||||
|
#Dictionary of pickups.
|
||||||
|
#--Weapons--#
|
||||||
|
#Order of Attributes: Spritename, attackType, Cooldown(Seconds), Power cooldown(Seconds), Damage, Power Damage, Range(pixels), Speed.
|
||||||
|
BigDict["Pickups"]["Weapons"]["Ranged"] = [["Bow", "proj", 0.5, 2.5, 0.75, 1.25, 1024, 1.0],
|
||||||
|
["Crossbow", "proj", 0.75, 2.0, 1.25, 1.0, 512, 175],
|
||||||
|
["Rifle", "proj", 0.75, 4.3, 1.4, 2.0, 1536, 2.2],
|
||||||
|
["Bomb", "Special", 1.0, 7.0, 2.5, 2.5, 256, 0.5]]
|
||||||
|
|
||||||
|
# The outer list is the direction in which the player is facing (W, E, N, S)
|
||||||
|
# The tuples inside that are the points for each frame
|
||||||
|
swordPtList = [ [[(-68, -23), (-48, -23)], [(-79, -23), (-58, -23)], [(-88, -23), (-68, -23)], [(-68, -23), (-48, -23)]], #swordPtList[0]
|
||||||
|
[[(69,-23), (49, -23)], [(90,-23), (70, -23)], [(80,-23), (60, -23)], [(74,-23), (54, -23)]], #swordPtList[1]
|
||||||
|
[[(28, -80), (28, -60)], [(28, -99), (28, -79)], [(28, -94), (28, -74)], [(28, -85), (28, -65)]], #swordPtList[2]
|
||||||
|
[[(-28, 38), (-28, 18)], [(-28, 56), (-28, 36)], [(-28, 51), (-28, 31)], [(-28, 39), (-28, 19)]] ] #swordPtList[3]
|
||||||
|
|
||||||
|
scythePtList = [ [[(-30,-59), (-60, -29)], [(-30,-59), (-60, -29)], [(-30,-59), (-60, -29)], [(-30,-59), (-60, -29)]], #scythePtList[0]
|
||||||
|
[[(34,-59), (64, -29)], [(34,-59), (64, -29)], [(34,-59), (64, -29)], [(34,-59), (64, -29)]], #scythePtList[1]
|
||||||
|
[[(23,-70), (-13, -100)], [(23,-70), (-13, -100)], [(23,-70), (-13, -100)], [(23,-70), (-13, -100)]], #scythePtList[2]
|
||||||
|
[[(-23, 16), (7, 36)], [(-23, 16), (7, 36)], [(-23, 16), (7, 36)], [(-23, 16), (7, 36)]] ] #scythePtList[3]
|
||||||
|
|
||||||
|
BigDict["Pickups"]["Weapons"]["Melee"] = [["Sword", "stab", 0.6, 3, 1.0, 1.5, 0.0, 0.0, swordPtList],
|
||||||
|
["StrongSword", "stab", 0.6, 3, 2.0, 3.0, 0.0, 0.0, swordPtList],
|
||||||
|
["Scythe", "arc", 0.75, 5.1, 1.8, 2.5, 0.0, 0.0, scythePtList],
|
||||||
|
["Axe", "stab", 0.75, 4.5, 1.5, 1.75, 0.0, 0.0],
|
||||||
|
["Spear", "stab", 0.65, 4.4, 1.6, 2.0, 0.0, 0.0]]
|
||||||
|
|
||||||
|
BigDict["Pickups"]["Weapons"]["Magic"] = [["MagicStaff", "proj", 0.75, 2.0, 1.0, 2.0, 1024, 0.6],
|
||||||
|
["FireStaff", "proj", 0.75, 2.0, 1.0, 1.5, 1024, 0.6],
|
||||||
|
["LightningStaff", "proj", 0.75, 2.0, 1.0, 1.5, 1024, 0.6],
|
||||||
|
["EarthStaff", "proj", 0.75, 2.0, 1.0, 1.0, 1024, 0.6],
|
||||||
|
["DoomStaff", "Special", 0.75, 2.5, 1.4, 2.5, 1024, 0.6]]
|
||||||
|
|
||||||
|
#--Pickups--#
|
||||||
|
BigDict["Pickups"]["Compass"] = ["Compass", True]
|
||||||
|
#Order of Attributes: Spritename, Boolean set to true.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
BigDict["Items"]["HealthPot"] = ["Potion_RedPU", "heal", 30]
|
||||||
|
#BigDict["Items"]["Sword"] = ["Claymore", "changeClass", ("Melee", BigDict["Pickups"]["Weapons"]["Melee"][0])]
|
||||||
|
BigDict["Items"]["Staff"] = ["staffPU", "changeClass", ("Magic", BigDict["Pickups"]["Weapons"]["Magic"][0])]
|
||||||
|
BigDict["Items"]["Scythe"] = ["ScythePU", "changeClass", ("Melee", BigDict["Pickups"]["Weapons"]["Melee"][2])]
|
||||||
|
BigDict["Items"]["Bow"] = ["BowPU", "changeClass", ("Ranged", BigDict["Pickups"]["Weapons"]["Ranged"][0])]
|
||||||
|
BigDict["Items"]["StrongSword"] = ["ClaymorePU", "changeClass", ("Melee", BigDict["Pickups"]["Weapons"]["Melee"][1])]
|
||||||
|
|
||||||
|
|
239
application.py
Normal file
@ -0,0 +1,239 @@
|
|||||||
|
import math2d
|
||||||
|
import pygame
|
||||||
|
import pane
|
||||||
|
import idevice
|
||||||
|
import world
|
||||||
|
import spriteDataBase
|
||||||
|
import soundDataBase
|
||||||
|
import gui_manager
|
||||||
|
import BigDict
|
||||||
|
import random
|
||||||
|
class Application(object):
|
||||||
|
""" Controls:
|
||||||
|
1. all pygame objects
|
||||||
|
2. the list of panes
|
||||||
|
3. world
|
||||||
|
4. sprite database
|
||||||
|
5. sound database
|
||||||
|
Calls all methods of every other object in the game"""
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
""" Initializes all data """
|
||||||
|
self.quit = False
|
||||||
|
self.pygameStartup()
|
||||||
|
|
||||||
|
self.soundeffects = soundDataBase.SoundDBase("sounds\\sound effects")
|
||||||
|
|
||||||
|
self.GManager = gui_manager.GUI_Manager(self)
|
||||||
|
|
||||||
|
# Temporarily create a single player (keyboard) & pane
|
||||||
|
self.IDeviceMasterList = [idevice.Keyboard()]
|
||||||
|
numSticks = pygame.joystick.get_count()
|
||||||
|
count = 0
|
||||||
|
while numSticks > 0:
|
||||||
|
self.IDeviceMasterList.append(idevice.Gamepad(count))
|
||||||
|
numSticks -= 1
|
||||||
|
count += 1
|
||||||
|
|
||||||
|
self.spriteSheets = spriteDataBase.ImageDBase("imgs\\player")
|
||||||
|
self.spriteSheets.addAdditionalDirectory("imgs\\enemy")
|
||||||
|
self.spriteSheets.addAdditionalDirectory("imgs\\pickup items")
|
||||||
|
#self.spriteSheets = spriteDataBase.ImageDBase("..\\Art") # Designate a path to your spritesheets folder.
|
||||||
|
#self.spriteSheets.addAdditionalDirectory("..\\Art\\Enemies")
|
||||||
|
#self.spriteSheets.addAdditionalDirectory("..\\Art\\Pick up items")
|
||||||
|
self.tileDBase = spriteDataBase.ImageDBase("imgs\\floor")
|
||||||
|
self.tileDBase.addAdditionalDirectory("imgs\\wall")
|
||||||
|
|
||||||
|
self.guiDBase = spriteDataBase.ImageDBase("imgs\\gui")
|
||||||
|
|
||||||
|
#SOUND CODE...
|
||||||
|
self.soundeffects = soundDataBase.SoundDBase("sounds\\sound effects")
|
||||||
|
self.music = soundDataBase.SoundDBase("sounds\\music")
|
||||||
|
self.songs = 6 #How many fight themes are in the music folder...
|
||||||
|
self.musicOrder = [random.randint(1,self.songs),] #self.musicOrder will have randomized numbers from one to however many songs there are.
|
||||||
|
#Songs are looped in this order, in-game. The following code randomly appends the next numbers...
|
||||||
|
newval = None
|
||||||
|
numberUnused = False
|
||||||
|
counter = 1
|
||||||
|
while counter < self.songs: #There are six songs so far.
|
||||||
|
val = random.randint(1, self.songs)
|
||||||
|
for i in self.musicOrder:
|
||||||
|
if val == i:
|
||||||
|
numberUnused = False
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
numberUnused = True
|
||||||
|
if numberUnused:
|
||||||
|
self.musicOrder.append(val)
|
||||||
|
counter += 1
|
||||||
|
|
||||||
|
self.musicIndex = 0 #This index is incremented in self.update()
|
||||||
|
#self.world = world.World((6,4), self.tileDBase, self.spriteSheets)
|
||||||
|
self.panes = []
|
||||||
|
# TEMPORARY -- just to test idevice code.
|
||||||
|
self.testPos = math2d.Vector2(400,300)
|
||||||
|
|
||||||
|
def onAction(self, action, devNum):
|
||||||
|
""" Called once when an 'action' is made (e.g. 'attack',
|
||||||
|
'pattack', 'interact', 'use') """
|
||||||
|
# TO-DO: Call Player functions
|
||||||
|
#print("on action num",devNum)
|
||||||
|
dic = self.GManager.handleAction(action,devNum)
|
||||||
|
#if(self.GManager.mode=="create" or self.GManager.mode=="menu" or self.GManager.mode=="options" or self.GManager.mode=="title"):
|
||||||
|
if dic != None:
|
||||||
|
#print(dic)
|
||||||
|
dim = dic["dim"]
|
||||||
|
#print(dim)
|
||||||
|
player = dic["player"]
|
||||||
|
#maps = dic["mapping"]
|
||||||
|
# Temporarily create a single player (keyboard) & pane
|
||||||
|
self.createGame(dic)
|
||||||
|
|
||||||
|
## def setPaneInput(self, dic):
|
||||||
|
## maps = dic["mapping"]
|
||||||
|
## for i in range(len(maps)):
|
||||||
|
## self.panes.idevice = self.IDeviceMasterList[maps[i][1]]
|
||||||
|
|
||||||
|
|
||||||
|
def createGame(self, dic):
|
||||||
|
""" Called after the countdown in the input-chooser screen. Creates the world and moves all players to
|
||||||
|
a random spawn point. """
|
||||||
|
dim = dic["dim"]
|
||||||
|
player = dic["player"]
|
||||||
|
maps = dic["mapping"]
|
||||||
|
self.panes = []
|
||||||
|
self.world = world.World(dim, self.tileDBase, self.spriteSheets)
|
||||||
|
if(player == 1):
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[0][1]], WorldPos, self.spriteSheets, (1024,768),self.world,self, (0,0), 0)) #-------------Resolution Changed From (800,600) to (1024,768)
|
||||||
|
if(player == 2):
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[0][1]], WorldPos, self.spriteSheets, (512,768),self.world, self, (0,0), 0))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[1][1]], WorldPos, self.spriteSheets, (512,768),self.world, self, (512,0), 1)) #NEED TO CHANGE
|
||||||
|
if(player == 3):
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[0][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(0,0), 0))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[1][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(512,0), 1))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[2][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(0,384), 2)) # 3 player split screen
|
||||||
|
if(player == 4):
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[0][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(0,0), 0))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[1][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(512,0), 1))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[2][1]], WorldPos, self.spriteSheets, (512,384),self.world,self,(0,384), 2))
|
||||||
|
WorldPos = random.choice(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.panes.append(pane.Pane(self.IDeviceMasterList[maps[3][1]], WorldPos, self.spriteSheets, (512,384),self.world, self,(512,384), 3)) #4 player split screen
|
||||||
|
|
||||||
|
def refresh(self):
|
||||||
|
pygame.joystick.quit()
|
||||||
|
pygame.joystick.init()
|
||||||
|
self.IDeviceMasterList = [idevice.Keyboard()]
|
||||||
|
numSticks = pygame.joystick.get_count()
|
||||||
|
count = 0
|
||||||
|
while numSticks > 0:
|
||||||
|
self.IDeviceMasterList.append(idevice.Gamepad(count))
|
||||||
|
numSticks -= 1
|
||||||
|
count += 1
|
||||||
|
#self.panes = [pane.Pane(self.IDeviceMasterList[count], math2d.Vector2(400,300), self.spriteSheets, (1024,768),self.world)]
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
""" Starts the game. """
|
||||||
|
while not self.quit:
|
||||||
|
dT = self.clock.tick() / 1000.0
|
||||||
|
if pygame.key.get_pressed()[pygame.K_ESCAPE]:
|
||||||
|
self.quit = True
|
||||||
|
self.update(dT)
|
||||||
|
self.render()
|
||||||
|
self.pygameShutdown()
|
||||||
|
|
||||||
|
def render(self):
|
||||||
|
# Note: We'll probably need to pass the players to this
|
||||||
|
# function eventually
|
||||||
|
#if self.GManager.mode != "game":
|
||||||
|
#if self.GManager.mode in ("game", "title", "main", "menu", "create"):
|
||||||
|
if self.GManager.mode != "game" and self.GManager.mode != "input":
|
||||||
|
self.GManager.render(self.screen)
|
||||||
|
else:
|
||||||
|
for pane in self.panes:
|
||||||
|
pane.render(self.panes)
|
||||||
|
self.GManager.render(pane.surface, pane, self.panes)
|
||||||
|
if len(self.panes) == 1:
|
||||||
|
self.screen.blit(self.panes[0].surface, (0,0))
|
||||||
|
if len(self.panes) == 2:
|
||||||
|
self.screen.blit(self.panes[0].surface, (0,0))
|
||||||
|
self.screen.blit(self.panes[1].surface, (self.screen.get_width()/2,0))
|
||||||
|
if len(self.panes) == 3:
|
||||||
|
self.screen.blit(self.panes[0].surface, (0,0))
|
||||||
|
self.screen.blit(self.panes[1].surface, (self.screen.get_width()/2,0))
|
||||||
|
self.screen.blit(self.panes[2].surface, (0,self.screen.get_height()/2))
|
||||||
|
if len(self.panes) == 4:
|
||||||
|
self.screen.blit(self.panes[0].surface, (0,0))
|
||||||
|
self.screen.blit(self.panes[1].surface, (self.screen.get_width()/2,0))
|
||||||
|
self.screen.blit(self.panes[2].surface, (0,self.screen.get_height()/2))
|
||||||
|
self.screen.blit(self.panes[3].surface, (self.screen.get_width()/2,self.screen.get_height()/2))
|
||||||
|
if len(self.panes) == 2:
|
||||||
|
self.screen.blit(self.guiDBase.get("twoPlayer_Split"), (0,0))
|
||||||
|
elif len(self.panes) >= 3:
|
||||||
|
self.screen.blit(self.guiDBase.get("fourPlayer_Split"), (0,0))
|
||||||
|
# Draw the fps on the upper-left
|
||||||
|
self.screen.blit(self.debugFont.render("FPS: " + str(round(self.clock.get_fps(),1)), False, (255,0,0), (0,0,0)), (5,5))
|
||||||
|
pygame.display.flip()
|
||||||
|
|
||||||
|
def pygameStartup(self):
|
||||||
|
""" Load all pygame objects """
|
||||||
|
pygame.display.init()
|
||||||
|
pygame.joystick.init()
|
||||||
|
pygame.font.init()
|
||||||
|
pygame.mixer.init()
|
||||||
|
self.screen = pygame.display.set_mode((1024,768),pygame.FULLSCREEN)
|
||||||
|
self.debugFont = pygame.font.SysFont("Courier New", 14) # Temporary for testing
|
||||||
|
self.clock = pygame.time.Clock()
|
||||||
|
|
||||||
|
def update(self, dT):
|
||||||
|
eList = pygame.event.get()
|
||||||
|
volume = self.GManager.Update(dT) / 10
|
||||||
|
if self.GManager.mode == "game":
|
||||||
|
if pygame.mixer.music.get_busy() == False:
|
||||||
|
MusicSelection = "FightTheme"+str(self.musicOrder[self.musicIndex])+".mp3"
|
||||||
|
print(MusicSelection)
|
||||||
|
pygame.mixer.music.load("sounds\\music\\"+ MusicSelection)
|
||||||
|
pygame.mixer.music.set_volume(volume)
|
||||||
|
pygame.mixer.music.play(0, 0.0)
|
||||||
|
self.musicIndex += 1
|
||||||
|
if self.musicIndex > self.songs - 1:
|
||||||
|
self.musicIndex = 0
|
||||||
|
|
||||||
|
self.world.update(dT)
|
||||||
|
for dev in self.IDeviceMasterList:
|
||||||
|
dev.update(eList, self)
|
||||||
|
if self.GManager.mode == "game" or self.GManager.mode == "input":
|
||||||
|
for p in self.panes:
|
||||||
|
p.update(dT, eList, self.world, self)
|
||||||
|
|
||||||
|
else:
|
||||||
|
if pygame.mixer.music.get_busy() == False:
|
||||||
|
MusicSelection = "Intro.mp3"
|
||||||
|
print(MusicSelection)
|
||||||
|
pygame.mixer.music.load("sounds\\music\\"+ MusicSelection)
|
||||||
|
pygame.mixer.music.set_volume(volume)
|
||||||
|
pygame.mixer.music.play(0, 0.0)
|
||||||
|
|
||||||
|
|
||||||
|
def onMovement(self, horiz, vert):
|
||||||
|
""" Called when a direction change is made (
|
||||||
|
i.e. gamepad: dpad / analog, keyboard: u/d/l/r).
|
||||||
|
IMPORTANT: This function should only be called
|
||||||
|
once for a movement """
|
||||||
|
# TO-DO: Call Player functions
|
||||||
|
self.GManager.handleMovement(horiz, vert)
|
||||||
|
|
||||||
|
def pygameShutdown(self):
|
||||||
|
""" Shuts pygame down """
|
||||||
|
pygame.font.quit()
|
||||||
|
pygame.joystick.quit()
|
||||||
|
pygame.mixer.quit()
|
||||||
|
pygame.display.quit()
|
836
entity.py
Normal file
@ -0,0 +1,836 @@
|
|||||||
|
import pygame
|
||||||
|
import math2d
|
||||||
|
import random
|
||||||
|
import BigDict
|
||||||
|
import copy
|
||||||
|
import world
|
||||||
|
|
||||||
|
class Entity(object):
|
||||||
|
""" A Generic thing that is draw on the screen.
|
||||||
|
Some common things:
|
||||||
|
1. Sprite
|
||||||
|
2. Position
|
||||||
|
3. Size
|
||||||
|
We will create derived classes from this for:
|
||||||
|
Players
|
||||||
|
Enemies
|
||||||
|
Loot
|
||||||
|
Pressure Plates
|
||||||
|
...
|
||||||
|
"""
|
||||||
|
def __init__(self, pos, spriteName, spriteDBase):
|
||||||
|
self.state = 0 # When 0, alive. When 1, dying. When 2, it is dead, and needs to be removed
|
||||||
|
self.spriteDB = spriteDBase # Needed for creating projectiles
|
||||||
|
self.sprite = spriteDBase.get(spriteName)
|
||||||
|
if not isinstance(pos, math2d.Vector2): # Making sure the position of this Entity is a Vector2 object
|
||||||
|
self.pos = math2d.Vector2(pos[0], pos[1]) # WORLD position of the bottom-middle of the character (feet when standing)
|
||||||
|
else:
|
||||||
|
self.pos = pos
|
||||||
|
self.size = 20 # Radius of the bounding circle (centered at self.pos) used for wall / trap hit-detection
|
||||||
|
# Normal size of (nearly) all entities is set here
|
||||||
|
self.hitRadius = 5 # The radius of the circle used for weapons
|
||||||
|
self.damageScale = 25 # Multiplied by the weapon damage factor
|
||||||
|
# ^^^ These two are placed here to be used for projectiles and the Player
|
||||||
|
|
||||||
|
def render(self, surf, cameraPos):
|
||||||
|
""" Draw a blobby shadow underneath the character """
|
||||||
|
# We might need to replace this with a "shadow" image; the corners
|
||||||
|
# of the rectangular surface appear around the circle as-is
|
||||||
|
tempS = pygame.Surface((self.size * 2, self.size * 2)) # Create an off-screen, semi-transparent (soon) surface
|
||||||
|
tempS.fill((255,255,255)) # Temporary?
|
||||||
|
tempS.set_alpha(64) # Arbitrary number for transparency; lower numbers = more transparent
|
||||||
|
tempS.set_colorkey((255,255,255))
|
||||||
|
|
||||||
|
pygame.draw.circle(tempS, (0,0,0), (self.size, self.size), self.size) # Draws the shadow
|
||||||
|
surf.blit(tempS, (self.pos[0] - cameraPos[0] - self.size, self.pos[1] - cameraPos[1] - self.size)) # Blit the shadow to the screen at self.pos
|
||||||
|
|
||||||
|
def update(self, dT):
|
||||||
|
""" Do any pertinent updates """
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Projectile(Entity):
|
||||||
|
""" A class for projectiles. Whenever a projectile is fired, create
|
||||||
|
a projectile object. """
|
||||||
|
def __init__(self, pos, spriteName, spriteDBase, firingWeapon, direction, shooter, atkType):
|
||||||
|
Entity.__init__(self, pos, spriteName, spriteDBase)
|
||||||
|
# NOTE: The position of the projectile is the point used for hit detection (the middle, front edge based on direction)
|
||||||
|
self.range = firingWeapon[6]
|
||||||
|
self.distTravelled = 0 # The amount of distance the projectile has already travelled
|
||||||
|
self.speed = 500 * firingWeapon[7]
|
||||||
|
if atkType == "Normal":
|
||||||
|
self.damage = firingWeapon[4]
|
||||||
|
elif atkType == "Power":
|
||||||
|
self.damage = firingWeapon[5]
|
||||||
|
self.direction = direction # W = 0, E = 1...
|
||||||
|
self.shooter = shooter # The object that fired this projectile - so the projectile doesn't hit the one that shot it
|
||||||
|
self.firingWeapon = firingWeapon[0]
|
||||||
|
self.drawOffset = math2d.Vector2(0, 0)
|
||||||
|
|
||||||
|
# self.drawOffset is the distance from self.pos to the top left corner of the sprite
|
||||||
|
if self.direction == 0 and self.firingWeapon == "Bow":
|
||||||
|
# Already facing correct direction; no rotation needed
|
||||||
|
self.drawOffset = math2d.Vector2(0, self.sprite.get_height() // 2)
|
||||||
|
|
||||||
|
elif self.direction == 1 and self.firingWeapon == "Bow":
|
||||||
|
self.sprite = pygame.transform.rotate(self.sprite, 180)
|
||||||
|
self.drawOffset = math2d.Vector2(self.sprite.get_width(), self.sprite.get_height() // 2)
|
||||||
|
|
||||||
|
elif self.direction == 2 and self.firingWeapon == "Bow":
|
||||||
|
self.sprite = pygame.transform.rotate(self.sprite, -90)
|
||||||
|
self.drawOffset = math2d.Vector2(self.sprite.get_width() // 2, 0)
|
||||||
|
|
||||||
|
elif self.direction == 3 and self.firingWeapon == "Bow":
|
||||||
|
self.sprite = pygame.transform.rotate(self.sprite, 90)
|
||||||
|
self.drawOffset = math2d.Vector2(self.sprite.get_width() // 2, self.sprite.get_height())
|
||||||
|
|
||||||
|
elif self.firingWeapon == "MagicStaff":
|
||||||
|
self.drawOffset = math2d.Vector2(32, 32)
|
||||||
|
|
||||||
|
def render(self, surf, cameraPos):
|
||||||
|
surf.blit(self.sprite, (int(self.pos[0] - self.drawOffset[0] - cameraPos[0]), int(self.pos[1] - self.drawOffset[1] - cameraPos[1])))
|
||||||
|
####### TEMPORARY #######
|
||||||
|
## pygame.draw.circle(surf, (255,0,0), (int(self.pos[0] - cameraPos[0]), int(self.pos[1] - cameraPos[1])), self.hitRadius)
|
||||||
|
|
||||||
|
def update(self, dT, checkList, world):
|
||||||
|
""" Updates the projectile. Performs the following:
|
||||||
|
1: Move the projectile in the correct direction
|
||||||
|
2: Determine how far the projectile has travelled
|
||||||
|
- If it has travelled the maximum range, change its state to 2 (dead)
|
||||||
|
3: Check to see if the projectile hits anything """
|
||||||
|
displacement = self.speed * dT # This is the amount of distance the projectile has moved
|
||||||
|
|
||||||
|
####### Move the projectile #######
|
||||||
|
if self.direction == 0: # West
|
||||||
|
self.pos[0] -= displacement
|
||||||
|
elif self.direction == 1: # East
|
||||||
|
self.pos[0] += displacement
|
||||||
|
elif self.direction == 2: # North
|
||||||
|
self.pos[1] -= displacement
|
||||||
|
elif self.direction == 3: # South
|
||||||
|
self.pos[1] += displacement
|
||||||
|
|
||||||
|
self.distTravelled += displacement # Add to the total distance travelled by the projectile
|
||||||
|
if self.distTravelled >= self.range: # The projectile has moved its maximum range
|
||||||
|
self.state = 2
|
||||||
|
# If this gets code stomped again, someone dies
|
||||||
|
if not (world.isSpotWalkable((self.pos[0]), (self.pos[1]))):
|
||||||
|
self.state = 2
|
||||||
|
|
||||||
|
for obj in checkList:
|
||||||
|
# Does the actual hit detection for this projectile
|
||||||
|
if obj == self.shooter: # Don't hit yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.pos[0], obj.pos[1] - self.pos[1] - 10)
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
if distance < obj.size + self.hitRadius: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
obj.health -= self.damage * self.damageScale
|
||||||
|
self.state = 2
|
||||||
|
|
||||||
|
class Mover(Entity):
|
||||||
|
""" A generic class of any entity that moves.
|
||||||
|
Some common things:
|
||||||
|
1. Has the ability to move
|
||||||
|
2. Has a health attribute
|
||||||
|
3. Able to perform actions (such as attack)
|
||||||
|
4. Able to trigger (most/all) traps
|
||||||
|
We will create derived classes from this for:
|
||||||
|
1. Player
|
||||||
|
2. Enemy
|
||||||
|
"""
|
||||||
|
def __init__(self, pos, spriteName, spriteDBase):
|
||||||
|
Entity.__init__(self, pos, spriteName, spriteDBase)
|
||||||
|
self.name = spriteName
|
||||||
|
self.speed = 200 # The speed of the Mover, in pixels per second - normal speed is set here
|
||||||
|
self.tempSpeed = self.speed # If the speed of the object changes, this changes - NOT self.speed
|
||||||
|
self.health = 100.0 # The health this object has - Will be changed later to reflect what class the player is (maybe?)
|
||||||
|
self.maxHealth = 100 # The maximum health this object can have
|
||||||
|
self.curAction = 0 # Walk, BeingHit, Falling, Idle, Dying
|
||||||
|
self.drawDirection = 0 # W, E, N, S
|
||||||
|
self.curFrame = 0
|
||||||
|
self.animDelay = 0.15 # The amount of time an object is in the same frame until it changes
|
||||||
|
self.frameTime = 0.0 # The amount of time this object has been in the same frame
|
||||||
|
self.projList = [] # A list of projectiles fired by this Mover
|
||||||
|
self.lastHitByPlayer = False # Though only used for the player, the entire Mover update method would have to be copied if
|
||||||
|
# this was ONLY in the Player class. This is why there is an isinstance check in update
|
||||||
|
def changeAction(self, newAction):
|
||||||
|
if self.state == 0:
|
||||||
|
self.curAction = newAction
|
||||||
|
if (newAction != 0): # Makes sure it's not walking, so it doesn't reset the animation
|
||||||
|
self.curFrame = 0 # As the action changes, the new action
|
||||||
|
# starts from the first frame
|
||||||
|
def changeDrawDirection(self, newDir):
|
||||||
|
""" Directions are as follows:
|
||||||
|
W = 0
|
||||||
|
E = 1
|
||||||
|
N = 2
|
||||||
|
S = 3 """
|
||||||
|
if self.state == 0:
|
||||||
|
if newDir != self.drawDirection:
|
||||||
|
self.drawDirection = newDir
|
||||||
|
|
||||||
|
if (self.curAction != 0):
|
||||||
|
self.curFrame = 0 # As the direction changes, the action
|
||||||
|
# starts from the first frame
|
||||||
|
def update(self, dT, checkList, world):
|
||||||
|
""" Modify curFrame (every self.animDelay seconds), wrapping around to
|
||||||
|
0 if we're at the end of the animation (use self.curAction) """
|
||||||
|
if self.health <= 0:
|
||||||
|
self.health = 0 # To stop health from going negative if strange things happen
|
||||||
|
if self.state == 0:
|
||||||
|
self.death()
|
||||||
|
|
||||||
|
if self.health > self.maxHealth:
|
||||||
|
self.health = self.maxHealth # Your health cannot exceed its maximum
|
||||||
|
|
||||||
|
self.frameTime += dT # Increment self.frameTime based on the time that has passed
|
||||||
|
|
||||||
|
for proj in self.projList:
|
||||||
|
if proj.state == 2: # The projectile is dead and needs to be removed
|
||||||
|
self.projList.remove(proj)
|
||||||
|
continue # Don't try to update the projectile afer it's been removed
|
||||||
|
proj.update(dT, checkList, world)
|
||||||
|
|
||||||
|
if self.frameTime >= self.animDelay:
|
||||||
|
self.curFrame += 1
|
||||||
|
self.frameTime = 0 # Reset self.frameTime if the frame changes
|
||||||
|
if self.curFrame >= 4:
|
||||||
|
self.curFrame = 0
|
||||||
|
self.frameTime = 0 # Reset self.frameTime if the frame changes
|
||||||
|
if self.state == 1: # If the object has gone through the "Dying" animation...
|
||||||
|
if not self.lastHitByPlayer and isinstance(self, Player):
|
||||||
|
self.respawn(world)
|
||||||
|
else:
|
||||||
|
self.state = 2 # ... change its state to "Dead"
|
||||||
|
|
||||||
|
self.tempSpeed = self.speed # If tempSpeed is changed, set it back to the original speed
|
||||||
|
|
||||||
|
def death(self):
|
||||||
|
""" Handles the death of the mover. Changes self.curAction to 4 (dying) and self.state to 1.
|
||||||
|
Update changes the state of the object to 2 when it's done dying """
|
||||||
|
if isinstance(self, Player):
|
||||||
|
if self.weapon[0] == "Sword":
|
||||||
|
self.appPtr.sounds["exploding head"].play()
|
||||||
|
else:
|
||||||
|
self.appPtr.sounds["death"].play()
|
||||||
|
self.curAction = 4 # The "Dying" action
|
||||||
|
self.state = 1 # State is now "Dying"
|
||||||
|
self.curFrame = 0
|
||||||
|
self.frameTime = 0
|
||||||
|
|
||||||
|
def fall(self):
|
||||||
|
""" Handles the death of the mover, IF they have fallen into a pit. """
|
||||||
|
self.curAction = 2 # The "Falling" action
|
||||||
|
self.state = 1
|
||||||
|
self.curFrame = 0
|
||||||
|
self.frameTime = 0
|
||||||
|
|
||||||
|
def render(self, surf, cameraPos):
|
||||||
|
""" Draw the blobby shadow (from Entity.render), then draw the current
|
||||||
|
sprite on top of it. Also, draws a green health bar above the current sprite
|
||||||
|
whose width is dependent on self.health. """
|
||||||
|
# Draws the shadow by using the render method of the Entity base class
|
||||||
|
Entity.render(self, surf, cameraPos)
|
||||||
|
# Draws the correct sprite on top of the shadow; for the rect argument,
|
||||||
|
# the first argument is the current column, the second argument is the
|
||||||
|
# currentAction (which determines which group of 4 rows to use) and which
|
||||||
|
# direction (which determines which of the 4 rows to use). Each sprite is 64x64
|
||||||
|
surf.blit(self.sprite, (self.pos[0] - 32 - cameraPos[0], self.pos[1] - 64 - cameraPos[1]), (self.curFrame * 64,
|
||||||
|
self.curAction * 256 + self.drawDirection * 64, 64,64))
|
||||||
|
# Render all projectiles associated with this object
|
||||||
|
for proj in self.projList:
|
||||||
|
proj.render(surf, cameraPos)
|
||||||
|
# Health bar
|
||||||
|
pygame.draw.rect(surf, (0,0,0), (self.pos[0] - 49 - cameraPos[0], self.pos[1] - 65 - cameraPos[1], 102, 4))
|
||||||
|
pygame.draw.rect(surf, (0,255,0), (self.pos[0] - 48 - cameraPos[0], self.pos[1] - 64 - cameraPos[1], self.health, 2))
|
||||||
|
|
||||||
|
class Player(Mover):
|
||||||
|
""" A player-controlled entity. Able to access Loot. Able to trigger all traps.
|
||||||
|
Has a weapon dictionary-attribute that includes:
|
||||||
|
Weapon Type
|
||||||
|
Range
|
||||||
|
Attack Damage
|
||||||
|
Power-Attack Type
|
||||||
|
Power-Attack Recharge Rate
|
||||||
|
Power-Attack Damage
|
||||||
|
which will change as the player changes weapons."""
|
||||||
|
def __init__(self, pos, spriteName, spriteDBase, app):
|
||||||
|
Mover.__init__(self, pos, spriteName, spriteDBase)
|
||||||
|
self.is_attacking = False # True when the ANIMATION for the attack is going (actually checking for hits)
|
||||||
|
self.atkCooldown = 1.0 # Determines when the player can attack. 1.0 is ready (percentage)
|
||||||
|
self.is_p_atk = False # True when the ANIMATION for the p atk is going (checking for hits)
|
||||||
|
self.paCharge = 1.0 # Determines when the player can use a power attack. 1.0 is fully charged (percentage)
|
||||||
|
self.pAttackColor = (0,0,255)
|
||||||
|
self.hand_action = 1 # Initially idle; works just like curAction does for rendering the knight, just for the hands
|
||||||
|
# Additional note: THIS NUMBER DOES NOT DIFFERENTIATE between attacking and otherwise
|
||||||
|
self.hand_frameTime = 0.0 # The amount of time the current hand frame has been shown - used with self.animDelay
|
||||||
|
self.hand_frame = 0 # The current frame for the hands
|
||||||
|
self.walkDmgTimer = 1.0 # When at 1.0, walking on an enemy will cause damage; if less than that, temporary invuln from this kind of dmg
|
||||||
|
self.lastHitByPlayer = False # Set to True if the player is hit by another player, until hit by something other than a player (including ALL traps)
|
||||||
|
# For self.weapon: Spritename, attackType, Cooldown (seconds), Power Cooldown (seconds), Damage, Power Damage, Range (pixels), Proj. Speed, hitPtList
|
||||||
|
self.weapon = BigDict.BigDict["Pickups"]["Weapons"]["Melee"][0] # Sets self.weapon to the Sword list
|
||||||
|
self.weaponSprite = spriteDBase.get(self.weapon[0])
|
||||||
|
self.handSprite = spriteDBase.get("hands")
|
||||||
|
#Sound attributes
|
||||||
|
self.appPtr = app
|
||||||
|
self.lavaBool = False
|
||||||
|
|
||||||
|
def onMove(self, dT, horiz, vert, w):#Does this junk even do anything? Lol
|
||||||
|
""" horiz and vert are both floats between -1.0 and 1.0. Change self.pos """
|
||||||
|
if self.state == 0:
|
||||||
|
if (w.isSpotWalkable((self.pos[0]) + horiz * (self.size + self.tempSpeed * dT), (self.pos[1]))):
|
||||||
|
self.pos[0] += horiz * self.tempSpeed * dT
|
||||||
|
if (w.isSpotWalkable((self.pos[0]), (self.pos[1]) + vert * (self.size + self.tempSpeed * dT))):
|
||||||
|
self.pos[1] += vert * self.tempSpeed * dT
|
||||||
|
# Keeping these ^^^ as two separate if statements. Prevents "sticky" walls when pressing more than 1 direction.
|
||||||
|
|
||||||
|
def walkEnemyDmg(self, checkList):
|
||||||
|
""" Check against the checkList to see if you are standing on an enemy. If so,
|
||||||
|
cause damage to the player and set self.walkDmgTimer to 0.0. This will be incremented
|
||||||
|
in the update method back up to 1.0. """
|
||||||
|
if self.state == 0:
|
||||||
|
if self.walkDmgTimer < 1.0:
|
||||||
|
return None # If the timer is not full, no damage is taken, nothing happens
|
||||||
|
for ene in checkList:
|
||||||
|
if isinstance(ene, Enemy):
|
||||||
|
distance = (ene.pos - self.pos).length() # Gets distance between player pos and enemby pos.
|
||||||
|
if distance > ene.size + self.size: # If the length is greater than both radius combine. No collision
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
self.lastHitByPlayer = False
|
||||||
|
self.health -= ene.damage # Cause damage (Health points take 5.0 damage points)
|
||||||
|
self.appPtr.sounds[random.choice(("hit1", "hit2", "hit3"))].play()
|
||||||
|
self.walkDmgTimer = 0.0 # Resets self.walkDmgTimer back to 0.0
|
||||||
|
if self.health < 0: # Health cannot be negative.
|
||||||
|
self.health = 0
|
||||||
|
return None # Once you within contact of an enemy stop checking.
|
||||||
|
|
||||||
|
def walkLootCheck(self, checkList):
|
||||||
|
""" Check to see if the player has walked over any loot. If so, check to see what type of loot,
|
||||||
|
and call the correct method from there. """
|
||||||
|
if self.state == 0:
|
||||||
|
for loot in checkList:
|
||||||
|
if isinstance(loot, Loot):
|
||||||
|
|
||||||
|
distance = (loot.pos - self.pos).length()
|
||||||
|
if distance > loot.size + self.size:
|
||||||
|
continue
|
||||||
|
else:
|
||||||
|
print("Here")
|
||||||
|
loot.state = 2
|
||||||
|
# Type check to see if it is a weapon or a potion
|
||||||
|
if loot.action == "heal":
|
||||||
|
self.appPtr.sounds["health"].play()
|
||||||
|
self.health += loot.value
|
||||||
|
elif loot.action == "changeClass":
|
||||||
|
self.appPtr.sounds["pickup"].play()
|
||||||
|
self.pickUpWeapon(loot)
|
||||||
|
|
||||||
|
def attack(self, checkList):
|
||||||
|
""" checkList is the list of objects to test for a hit.
|
||||||
|
Check to see if the player hits anything.
|
||||||
|
If there is a hit, handle it. """
|
||||||
|
if self.state == 0:
|
||||||
|
if self.is_p_atk or self.atkCooldown < 1.0:
|
||||||
|
return None # If the player is already attacking or on cooldown, nothing will happen.
|
||||||
|
|
||||||
|
self.is_attacking = True
|
||||||
|
self.atkCooldown = 0.0 # Needs to recharge back up to 1 before it can be used again
|
||||||
|
self.hand_frame = 0
|
||||||
|
|
||||||
|
if self.weapon[0] == "Sword" or self.weapon[0] == "StrongSword":
|
||||||
|
self.swordAttack(checkList)
|
||||||
|
|
||||||
|
elif self.weapon[0] == "Scythe":
|
||||||
|
self.scytheAttack(checkList)
|
||||||
|
|
||||||
|
elif self.weapon[0] == "Bow":
|
||||||
|
self.bowAttack(checkList)
|
||||||
|
|
||||||
|
elif self.weapon[0] == "MagicStaff":
|
||||||
|
self.staffAttack(checkList)
|
||||||
|
|
||||||
|
def playHitSound(self, obj):
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
self.appPtr.sounds[random.choice(("hit1", "hit2", "hit3"))].play()
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
elif obj.name == "slime" or obj.name == "slime00cas" or obj.name == "slime00des":
|
||||||
|
self.appPtr.sounds["slime hit"].play()
|
||||||
|
elif obj.name == "Skeleton Archer":
|
||||||
|
self.appPtr.sounds["skeleton hit"].play()
|
||||||
|
elif obj.name == "ghost":
|
||||||
|
self.appPtr.sounds["ghost hit"].play()
|
||||||
|
else: #bomb
|
||||||
|
self.appPtr.sounds[random.choice(("bomb hit1", "bomb hit2", "bomb hit3"))].play()
|
||||||
|
|
||||||
|
def scytheAttack(self, checkList):
|
||||||
|
""" The hit detection if using a SCYTHE. """
|
||||||
|
self.appPtr.sounds["Scythe"].play()
|
||||||
|
for obj in checkList:
|
||||||
|
######### HIT DETECTION FOR hitPtFar! ############
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.hitPtFar[0], obj.pos[1] - self.hitPtFar[1] - 10)
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
if distance < obj.size + self.hitRadius: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[4] * self.damageScale // 2
|
||||||
|
|
||||||
|
for obj in checkList:
|
||||||
|
######### HIT DETECTION FOR hitPtNear! ###########
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.hitPtNear[0], obj.pos[1] - self.hitPtNear[1] - 10)
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
if distance < obj.size + self.hitRadius: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[4] * self.damageScale // 2
|
||||||
|
|
||||||
|
def swordAttack(self, checkList):
|
||||||
|
""" The hit detection if using a SWORD. """
|
||||||
|
self.appPtr.sounds["sword"].play()
|
||||||
|
for obj in checkList:
|
||||||
|
######### HIT DETECTION FOR hitPtFar! ############
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.hitPtFar[0], obj.pos[1] - self.hitPtFar[1] - 10)
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
if distance < obj.size + self.hitRadius: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[4] * self.damageScale // 2 # Only the tip of the sword has hit; the full damage is applied if both points hit the target
|
||||||
|
|
||||||
|
for obj in checkList:
|
||||||
|
######### HIT DETECTION FOR hitPtNear! ###########
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.hitPtNear[0], obj.pos[1] - self.hitPtNear[1] - 10)
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
if distance < obj.size + self.hitRadius: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[4] * self.damageScale // 2 # Only the middle of the sword has hit; the full damage is applied if both points hit the target
|
||||||
|
|
||||||
|
def bowAttack(self, checkList):
|
||||||
|
""" Hit detection for the BOW. Creates a projectile that handles all hit detection """
|
||||||
|
####### Finding the position of the new projectile #######
|
||||||
|
if self.drawDirection == 0:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] - 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 1:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] + 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 2:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] - 64)
|
||||||
|
elif self.drawDirection == 3:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] + 64)
|
||||||
|
|
||||||
|
self.appPtr.sounds["arrow"].play()
|
||||||
|
newProjectile = Projectile(projPos, "arrow", self.spriteDB, self.weapon, self.drawDirection, self, "Normal")
|
||||||
|
self.projList.append(newProjectile)
|
||||||
|
|
||||||
|
def staffAttack(self, checkList):
|
||||||
|
""" Hit detection for the STAFF. Creates a projectile that handles all hit detection """
|
||||||
|
####### Finding the position of the new projectile #######
|
||||||
|
self.appPtr.sounds["staff"].play()
|
||||||
|
if self.drawDirection == 0:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] - 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 1:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] + 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 2:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] - 64)
|
||||||
|
elif self.drawDirection == 3:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] + 64)
|
||||||
|
|
||||||
|
newProjectile = Projectile(projPos, "Blue projectile", self.spriteDB, self.weapon, self.drawDirection, self, "Normal")
|
||||||
|
self.projList.append(newProjectile)
|
||||||
|
|
||||||
|
def swordP_Attack(self, checkList):
|
||||||
|
for obj in checkList:
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
|
||||||
|
if self.drawDirection == 0: # Facing West
|
||||||
|
if obj.pos[0] > self.pos[0]: # If the object is to your right, skip it
|
||||||
|
continue
|
||||||
|
elif self.drawDirection == 1: # Facing East
|
||||||
|
if obj.pos[0] < self.pos[0]: # If the object is to your left, skip it
|
||||||
|
continue
|
||||||
|
elif self.drawDirection == 2: # Facing North
|
||||||
|
if obj.pos[1] > self.pos[1]: # If the object is below you, skip it
|
||||||
|
continue
|
||||||
|
elif self.drawDirection == 3: # Facing South
|
||||||
|
if obj.pos[1] < self.pos[1]: # If the object is above you, skip it
|
||||||
|
continue
|
||||||
|
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.pos[0], obj.pos[1] - self.pos[1])
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
# 96 is the distance the Scythe reaches (192/2)
|
||||||
|
if distance < 96: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[5] * self.damageScale
|
||||||
|
|
||||||
|
def scytheP_Attack(self, checkList):
|
||||||
|
for obj in checkList:
|
||||||
|
if obj == self: # Don't check hits against yourself
|
||||||
|
continue
|
||||||
|
if isinstance(obj, Player) or isinstance(obj, Enemy):
|
||||||
|
# Calculates the distance (scalar) between the hit point and the object
|
||||||
|
distance = math2d.Vector2(obj.pos[0] - self.pos[0], obj.pos[1] - self.pos[1])
|
||||||
|
distance = distance.length()
|
||||||
|
|
||||||
|
# 96 is the distance the Scythe reaches (192/2)
|
||||||
|
if distance < 96: # If the object is hit, handle the hit (below)
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
obj.lastHitByPlayer = True
|
||||||
|
self.playHitSound(obj)
|
||||||
|
obj.health -= self.weapon[5] * self.damageScale
|
||||||
|
|
||||||
|
def bowP_Attack(self, checkList):
|
||||||
|
if self.drawDirection == 0:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] - 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 1:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] + 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 2:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] - 64)
|
||||||
|
elif self.drawDirection == 3:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] + 64)
|
||||||
|
|
||||||
|
newProjectile = Projectile(projPos, "flaming_arrow", self.spriteDB, self.weapon, self.drawDirection, self, "Power")
|
||||||
|
self.projList.append(newProjectile)
|
||||||
|
|
||||||
|
def staffP_Attack(self, checkList):
|
||||||
|
if self.drawDirection == 0:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] - 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 1:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] + 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 2:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] - 64)
|
||||||
|
elif self.drawDirection == 3:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] + 64)
|
||||||
|
|
||||||
|
newProjectile = Projectile(projPos, "purple projectile", self.spriteDB, self.weapon, self.drawDirection, self, "Power")
|
||||||
|
self.projList.append(newProjectile)
|
||||||
|
|
||||||
|
def p_attack(self, checkList = None):
|
||||||
|
""" checkList is the list of objects to test for a hit.
|
||||||
|
Check to see if the player hits anything.
|
||||||
|
If there is a hit, handle it. """
|
||||||
|
if self.state == 0:
|
||||||
|
if self.is_attacking or self.paCharge < 1.0:
|
||||||
|
return None # If the player is already attacking or on cooldown, nothing will happen.
|
||||||
|
|
||||||
|
self.paCharge = 0.0 # Needs to recharge back up to 1 before it can be used again
|
||||||
|
self.pAttackColor = (0,0,255)
|
||||||
|
self.is_p_atk = True
|
||||||
|
self.hand_frame = 0
|
||||||
|
|
||||||
|
if self.weapon[0] == "Sword" or self.weapon[0] == "StrongSword":
|
||||||
|
self.appPtr.sounds["sword"].play()
|
||||||
|
self.swordP_Attack(checkList)
|
||||||
|
elif self.weapon[0] == "Scythe":
|
||||||
|
self.appPtr.sounds["Scythe"].play()
|
||||||
|
self.scytheP_Attack(checkList)
|
||||||
|
|
||||||
|
elif self.weapon[0] == "Bow":
|
||||||
|
self.appPtr.sounds["arrow"].play()
|
||||||
|
self.bowP_Attack(checkList)
|
||||||
|
|
||||||
|
elif self.weapon[0] == "MagicStaff":
|
||||||
|
self.appPtr.sounds["staff"].play()
|
||||||
|
self.staffP_Attack(checkList)
|
||||||
|
|
||||||
|
def pickUpWeapon(self, newWeapon):
|
||||||
|
self.weapon = newWeapon.value[1]
|
||||||
|
self.weaponSprite = self.spriteDB.get(self.weapon[0])
|
||||||
|
if newWeapon.value[0] == "Melee":
|
||||||
|
self.name = "Knight"
|
||||||
|
self.sprite = self.spriteDB.get("Knight")
|
||||||
|
elif newWeapon.value[0] == "Ranged":
|
||||||
|
self.name = "Archer"
|
||||||
|
self.sprite = self.spriteDB.get("Archer")
|
||||||
|
elif newWeapon.value[0] == "Magic":
|
||||||
|
self.name = "Mage"
|
||||||
|
self.sprite = self.spriteDB.get("Mage")
|
||||||
|
|
||||||
|
def update(self, dT, checkList, w):
|
||||||
|
Mover.update(self, dT, checkList, w)
|
||||||
|
|
||||||
|
if self.is_attacking: # Attacking
|
||||||
|
self.hand_action = 0
|
||||||
|
|
||||||
|
elif self.is_p_atk: # P-attacking
|
||||||
|
self.hand_action = 1
|
||||||
|
|
||||||
|
elif self.curAction == 0: # Walking
|
||||||
|
self.hand_action = 0
|
||||||
|
|
||||||
|
elif self.curAction == 3: # Idle
|
||||||
|
self.hand_action = 1
|
||||||
|
|
||||||
|
self.hand_frameTime += dT # Add to the hand frame timer
|
||||||
|
|
||||||
|
if self.paCharge < 1.0:
|
||||||
|
self.paCharge += dT / self.weapon[3] # Divide dT by the cooldown to increase paCharge by a percentage
|
||||||
|
else:
|
||||||
|
self.pAttackColor = (255,0,255) # Not even sure what this is, but I think it's necessary for GUI things
|
||||||
|
|
||||||
|
if self.atkCooldown < 1.0:
|
||||||
|
self.atkCooldown += dT / self.weapon[2] # Divide dT by the cooldown of the attack to increase by percentage
|
||||||
|
|
||||||
|
if self.walkDmgTimer < 1.0:
|
||||||
|
self.walkDmgTimer += dT # Increment the damage timer for walking over enemies
|
||||||
|
|
||||||
|
if self.hand_frameTime >= self.animDelay:
|
||||||
|
self.hand_frame += 1 # Change to the next hand frame
|
||||||
|
self.hand_frameTime = 0 # Reset the timer to 0
|
||||||
|
if self.hand_frame < 4:
|
||||||
|
if self.weapon[0] == "Sword" or self.weapon[0] == "StrongSword":
|
||||||
|
self.hitPtFar = math2d.Vector2(self.weapon[8][self.drawDirection][self.hand_frame][0][0] + self.pos[0],
|
||||||
|
self.weapon[8][self.drawDirection][self.hand_frame][0][1] + self.pos[1])
|
||||||
|
self.hitPtNear = math2d.Vector2(self.weapon[8][self.drawDirection][self.hand_frame][1][0] + self.pos[0],
|
||||||
|
self.weapon[8][self.drawDirection][self.hand_frame][1][1] + self.pos[1])
|
||||||
|
if self.weapon[0] == "Scythe":
|
||||||
|
self.hitPtNear = math2d.Vector2(self.weapon[8][self.drawDirection][self.hand_frame][0][0] + self.pos[0],
|
||||||
|
self.weapon[8][self.drawDirection][self.hand_frame][0][1] + self.pos[1])
|
||||||
|
self.hitPtFar = math2d.Vector2(self.weapon[8][self.drawDirection][self.hand_frame][1][0] + self.pos[0],
|
||||||
|
self.weapon[8][self.drawDirection][self.hand_frame][1][1] + self.pos[1])
|
||||||
|
if self.hand_frame >= 4:
|
||||||
|
self.hand_frame = 0 # Reset back to the first frame
|
||||||
|
self.hand_frameTime = 0
|
||||||
|
self.is_attacking = False
|
||||||
|
self.is_p_atk = False
|
||||||
|
|
||||||
|
trapCheck = (w.isSpotTrap((self.pos[0]), (self.pos[1])-5))
|
||||||
|
if trapCheck != -1 and self.state == 0:
|
||||||
|
#Pit
|
||||||
|
if trapCheck == 0:
|
||||||
|
self.lastHitByPlayer = False
|
||||||
|
self.fall()
|
||||||
|
self.appPtr.sounds["fall"].play()
|
||||||
|
#Spikes
|
||||||
|
elif trapCheck == 1:
|
||||||
|
if self.walkDmgTimer >= 1:
|
||||||
|
if self.lavaBool == True:
|
||||||
|
self.appPtr.sounds["lava"].stop()
|
||||||
|
self.lavaBool = False
|
||||||
|
self.appPtr.sounds["spike"].play()
|
||||||
|
self.lastHitByPlayer = False
|
||||||
|
self.health -= 10
|
||||||
|
self.appPtr.sounds[random.choice(("hit1", "hit2", "hit3"))].play()
|
||||||
|
self.walkDmgTimer = 0
|
||||||
|
self.speed = 75
|
||||||
|
#Lava
|
||||||
|
if trapCheck == 2:
|
||||||
|
if self.lavaBool == False:
|
||||||
|
self.appPtr.sounds["lava"].play()
|
||||||
|
self.lavaBool = True
|
||||||
|
if self.walkDmgTimer >= 1:
|
||||||
|
self.lastHitByPlayer = False
|
||||||
|
self.health -= 20
|
||||||
|
self.appPtr.sounds[random.choice(("hit1", "hit2", "hit3"))].play()
|
||||||
|
self.walkDmgTimer = 0
|
||||||
|
self.speed = 75
|
||||||
|
else:
|
||||||
|
self.speed = 200
|
||||||
|
self.appPtr.sounds["lava"].stop()
|
||||||
|
self.lavaBool = False
|
||||||
|
for obj in checkList:
|
||||||
|
if isinstance(obj, Enemy):
|
||||||
|
if obj.AI == "chase":
|
||||||
|
obj.visibles = checkList
|
||||||
|
|
||||||
|
def respawn(self,world):
|
||||||
|
spawnPoints = copy.deepcopy(BigDict.BigDict["WorldObjects"]["Spawnpoints"])
|
||||||
|
self.state = 0 # Revert the state of the player to 0 (normal)
|
||||||
|
self.health = 100 # Return the player to full health
|
||||||
|
spawnIndex = random.randint(0, len(spawnPoints) - 1)
|
||||||
|
self.pos = spawnPoints[spawnIndex] # Put the player's position at the chosen spawnPoint (randomly picked from possible spawnPoints)
|
||||||
|
self.pos = math2d.Vector2(self.pos[0], self.pos[1]) # To make sure position is a vector, not a tuple
|
||||||
|
if not world.isSpotWalkable(self.pos[0], self.pos[1], "normal") or world.isSpotTrap(self.pos[0], self.pos[1]-5)!=-1:
|
||||||
|
print("Trying respawn again, you got stuck in a wall or trap!")
|
||||||
|
self.respawn(world)
|
||||||
|
self.weapon = BigDict.BigDict["Pickups"]["Weapons"]["Melee"][0] # Sets self.weapon to the Sword list
|
||||||
|
self.weaponSprite = self.spriteDB.get(self.weapon[0])
|
||||||
|
self.sprite = self.spriteDB.get("Human")
|
||||||
|
self.name = "Human"
|
||||||
|
|
||||||
|
def render(self, surf, cameraPos):
|
||||||
|
if self.drawDirection == 2: # If the player is facing up...
|
||||||
|
self.render_hand(surf, cameraPos) # render the hands first
|
||||||
|
Mover.render(self, surf, cameraPos) # ...and the player is on top of the hands
|
||||||
|
|
||||||
|
else: # If the player is facing right/down/left...
|
||||||
|
Mover.render(self, surf, cameraPos) # render the player first
|
||||||
|
self.render_hand(surf, cameraPos) # ...and the hands are on top of the player
|
||||||
|
|
||||||
|
def render_hand(self, surf, cameraPos):
|
||||||
|
""" Renders the hands """
|
||||||
|
if self.is_attacking or self.is_p_atk: # If the player is attacking or power attacking, render the weapon
|
||||||
|
|
||||||
|
surf.blit(self.weaponSprite, (self.pos[0] - 96 - cameraPos[0], self.pos[1] - 96 - cameraPos[1]), (self.hand_frame * 192,
|
||||||
|
self.hand_action * 768 + self.drawDirection * 192, 192, 192))
|
||||||
|
## try: # A strange error was occuring; this is to handle that error
|
||||||
|
## # Draw the red dot at the tip of the sword, using the point list
|
||||||
|
## if self.weapon[0] == "Sword" or self.weapon[0] == "StrongSword" or self.weapon[0] == "Scythe":
|
||||||
|
## pygame.draw.circle(surf, (255,0,0), (int(self.hitPtFar[0] - cameraPos[0]), int(self.hitPtFar[1] - cameraPos[1])), self.hitRadius)
|
||||||
|
## pygame.draw.circle(surf, (255,0,0), (int(self.hitPtNear[0] - cameraPos[0]), int(self.hitPtNear[1] - cameraPos[1])), self.hitRadius)
|
||||||
|
##
|
||||||
|
## except: # To handle the strange error case where hitPtFar was not defined before this was called
|
||||||
|
## pass
|
||||||
|
|
||||||
|
else:
|
||||||
|
surf.blit(self.handSprite, (self.pos[0] - 96 - cameraPos[0], self.pos[1] - 96 - cameraPos[1]), (self.hand_frame * 192 + 3,
|
||||||
|
self.hand_action * 768 + self.drawDirection * 192 + 3, 192, 192))
|
||||||
|
|
||||||
|
class Enemy(Mover):
|
||||||
|
""" A NPC entity. Unable to access Loot. Able to trigger [most?] traps. """
|
||||||
|
def __init__(self, pos, sprite, spriteDBase):
|
||||||
|
Mover.__init__(self, pos, sprite, spriteDBase)
|
||||||
|
self.spriteName = sprite
|
||||||
|
self.duration = random.randint(1,5) # Randomly determines how long the enemy will maintain the same action
|
||||||
|
self.direction = random.randint(0,4) # Picks a random direction.
|
||||||
|
self.visibles = []
|
||||||
|
|
||||||
|
def randMove(self, dT, w):
|
||||||
|
""" Randomly moves the enemy in a direction for a duration, using self.duration and self.direction """
|
||||||
|
self.duration -= dT
|
||||||
|
|
||||||
|
if self.direction == 0: # If moving west: go left.
|
||||||
|
if (w.isSpotWalkable((self.pos[0]) - 16 + self.tempSpeed * dT, (self.pos[1]), "enemy") or (self.spriteName == "ghost" and self.pos[0] > 0)):
|
||||||
|
self.pos[0] -= self.tempSpeed * dT
|
||||||
|
self.changeDrawDirection(0)
|
||||||
|
elif self.direction == 1: # If moving east: go right.
|
||||||
|
if (w.isSpotWalkable((self.pos[0]) + 32 + self.tempSpeed * dT, (self.pos[1]), "enemy") or (self.spriteName == "ghost" and self.pos[0] < w.worldWidthT)):
|
||||||
|
self.pos[0] += self.tempSpeed * dT
|
||||||
|
self.changeDrawDirection(1)
|
||||||
|
elif self.direction == 2: # If moving north: go up.
|
||||||
|
if (w.isSpotWalkable((self.pos[0]), (self.pos[1]) - 16 + self.tempSpeed * dT, "enemy") or (self.spriteName == "ghost" and self.pos[1] > 0)):
|
||||||
|
self.pos[1] -= self.tempSpeed * dT
|
||||||
|
self.changeDrawDirection(2)
|
||||||
|
elif self.direction == 3: # If moving south: go down.
|
||||||
|
if (w.isSpotWalkable((self.pos[0]), (self.pos[1]) + 32 + self.tempSpeed * dT, "enemy") or (self.spriteName == "ghost" and self.pos[1] < w.worldHeightT)):
|
||||||
|
self.pos[1] += self.tempSpeed * dT
|
||||||
|
self.changeDrawDirection(3)
|
||||||
|
|
||||||
|
if self.duration <= 0: # Changes direction randomly, then randomly chooses new direction and rate.
|
||||||
|
self.changeDrawDirection(self.direction)
|
||||||
|
self.duration = random.randint(1,5)
|
||||||
|
self.direction = random.randint(0,4)
|
||||||
|
|
||||||
|
if self.AI == "range": # For ranged enemies
|
||||||
|
self.rangeFire(dT, w)
|
||||||
|
|
||||||
|
def chaserMove(self, dT, w):
|
||||||
|
""" AI pattern for enemies that chase you """
|
||||||
|
chaseDist = 800
|
||||||
|
for obj in self.visibles:
|
||||||
|
if isinstance(obj, Player):
|
||||||
|
# Calculating the distance between the Player and the Enemy
|
||||||
|
dist = math2d.Vector2(obj.pos[0] - self.pos[0], obj.pos[1] - self.pos[1])
|
||||||
|
distLength = dist.length() # Finding the length of that distance
|
||||||
|
# Start chasing the player if the Player is within the chase distance
|
||||||
|
if distLength <= chaseDist:
|
||||||
|
direct = dist.normalized() # Normalizing the distance so that it is a direction only
|
||||||
|
|
||||||
|
if abs(direct[0]) > abs(direct[1]) and direct[0] < 0: # Moving more in the x direction; also moving left
|
||||||
|
self.changeDrawDirection(0)
|
||||||
|
elif abs(direct[0]) > abs(direct[1]) and direct[0] > 0: # Moving more in the x direction; also moving right
|
||||||
|
self.changeDrawDirection(1)
|
||||||
|
elif abs(direct[0]) < abs(direct[1]) and direct[0] < 0: # Moving more in the y direction; also moving up
|
||||||
|
self.changeDrawDirection(2)
|
||||||
|
elif abs(direct[0]) < abs(direct[1]) and direct[0] > 0: # Moving more in the y direction; also moving down
|
||||||
|
self.changeDrawDirection(3)
|
||||||
|
|
||||||
|
# Making sure it doesn't walk through walls
|
||||||
|
#ignoring because GHOSTS ARE HOMING if (w.isSpotWalkable((self.pos[0]) + direct[0] * (self.size + self.tempSpeed * dT), (self.pos[1]))):
|
||||||
|
self.pos[0] += direct[0] * self.tempSpeed * dT
|
||||||
|
#if (w.isSpotWalkable((self.pos[0]), (self.pos[1]) + direct[1] * (self.size + self.tempSpeed * dT))):
|
||||||
|
self.pos[1] += direct[1] * self.tempSpeed * dT
|
||||||
|
|
||||||
|
break # After chasing one object, don't chase another
|
||||||
|
# I realize this will cause strange chase patterns if there are multiple players near the object;
|
||||||
|
# it won't always chase the nearest player with this code. We will implement this if we have time.
|
||||||
|
|
||||||
|
def rangeFire(self, dT, w):
|
||||||
|
"""AI to fire a projectile in a random direction"""
|
||||||
|
if self.drawDirection == 0:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] - 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 1:
|
||||||
|
projPos = math2d.Vector2(self.pos[0] + 64, self.pos[1] - 20)
|
||||||
|
elif self.drawDirection == 2:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] - 64)
|
||||||
|
elif self.drawDirection == 3:
|
||||||
|
projPos = math2d.Vector2(self.pos[0], self.pos[1] + 64)
|
||||||
|
try:
|
||||||
|
if projPos: # Debugging
|
||||||
|
newProjectile = Projectile(projPos, "arrow", self.spriteDB, self.weapon, self.drawDirection, self)
|
||||||
|
self.projList.append(newProjectile)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
|
||||||
|
def update(self, dT, w, checkList):
|
||||||
|
# The Mover.update will be called once enemy sprite sheets are implemented
|
||||||
|
# If the format of enemy sprite sheets is different that those of the player,
|
||||||
|
# then there will be a new update for the enemy class.
|
||||||
|
Mover.update(self, dT, checkList, w)
|
||||||
|
if self.state == 0:
|
||||||
|
if self.AI == "random":
|
||||||
|
self.randMove(dT, w)
|
||||||
|
if self.AI == "chase":
|
||||||
|
self.chaserMove(dT, w)
|
||||||
|
if self.AI == "range":
|
||||||
|
self.randMove(dT, w)
|
||||||
|
|
||||||
|
class Loot(Entity):
|
||||||
|
""" Any environmental entity that is helpful to the PLAYER.
|
||||||
|
Note: Enemies cannot access any loot. """
|
||||||
|
def __init__(self, pos, spritename, action, spriteDBase, value=None):
|
||||||
|
Entity.__init__(self, pos, spritename, spriteDBase)
|
||||||
|
self.action = action # A string of what the loot DOES (when picked up), either "changeClass" or "heal" for now
|
||||||
|
self.value = value # If it's a potion for example, the amount it heals by
|
||||||
|
|
||||||
|
def render(self, surf, cameraPos):
|
||||||
|
""" Draw the blobby shadow (from Entity.render), then draw the current
|
||||||
|
sprite on top of it """
|
||||||
|
# Draws the shadow by using the render method of the Entity base class
|
||||||
|
Entity.render(self, surf, cameraPos)
|
||||||
|
# Draws the sprite of this Loot item on top of the shadow
|
||||||
|
surf.blit(self.sprite, (self.pos[0] - self.sprite.get_width()/2 - cameraPos[0], self.pos[1] - self.sprite.get_height()/2 - cameraPos[1]))
|
||||||
|
|
||||||
|
class Easy(Enemy):
|
||||||
|
def __init__(self, pos, spriteName, health, attack, speed, AI, spriteDBase):
|
||||||
|
Enemy.__init__(self, pos, spriteName, spriteDBase)
|
||||||
|
self.speed = speed # Each enemy that has a different speed than 100 px/s is specified based upon the enemy
|
||||||
|
self.tempSpeed = self.speed
|
||||||
|
self.health = health
|
||||||
|
self.maxHealth = health # The maximum health - THIS VALUE SHOULD NOT CHANGE ONCE THE ENEMY IS CREATED.
|
||||||
|
self.damage = attack # Is this attack DAMAGE..? - JBrant: I am implementing it as the damage enemies cause when walked on.
|
||||||
|
self.AI = AI
|
||||||
|
if self.AI == "range":
|
||||||
|
self.weapon = BigDict.BigDict["Pickups"]["Weapons"]["Ranged"][0]
|
BIN
game font/HDirtyWhore-Regular.ttf
Normal file
BIN
game font/deathrattlebb_reg.ttf
Normal file
851
gui_manager.py
Normal file
@ -0,0 +1,851 @@
|
|||||||
|
import pygame
|
||||||
|
import math2d
|
||||||
|
import math
|
||||||
|
import pane
|
||||||
|
import soundDataBase
|
||||||
|
import BigDict # 16, 716
|
||||||
|
|
||||||
|
class GUI_Manager(object):
|
||||||
|
def __init__(self, app):
|
||||||
|
self.appPtr = app
|
||||||
|
self.mode = "title" # 'menu', 'credits', 'options',
|
||||||
|
self.selectionV = 1 # 'create', 'game','input', 'title'
|
||||||
|
self.selectionH = 2
|
||||||
|
self.width=4
|
||||||
|
self.height=5
|
||||||
|
self.playernum=1
|
||||||
|
self.music=10
|
||||||
|
self.soundfx=1
|
||||||
|
self.played = False
|
||||||
|
self.compassAngle = 50.0
|
||||||
|
self.pAttackColor = (0,0,255)
|
||||||
|
self.amongTheLiving = []
|
||||||
|
self.mapping = []
|
||||||
|
# Font objects/ images.
|
||||||
|
button_dic={"creditsButB":pygame.image.load("imgs\\gui\\Main Menu\\Credits_Black.png"),"creditsButR":pygame.image.load("imgs\\gui\\Main Menu\\Credits_Red.png"),\
|
||||||
|
"optionsButB":pygame.image.load("imgs\\gui\\Main Menu\\Options_Black.png"),"optionsButR":pygame.image.load("imgs\\gui\\Main Menu\\Options_Red.png"),\
|
||||||
|
"ngamebutB":pygame.image.load("imgs\\gui\\Main Menu\\NewGame_Black.png"),"ngamebutR":pygame.image.load("imgs\\gui\\Main Menu\\NewGame_Red.png"),\
|
||||||
|
"LArrowB":pygame.image.load("imgs\\gui\\Main Menu\\leftArrow_Black.png"),"LArrowR":pygame.image.load("imgs\\gui\\Main Menu\\leftArrow_Red.png"),\
|
||||||
|
"RArrowR":pygame.image.load("imgs\\gui\\Main Menu\\rightArrow_Red.png"),"RArrowB":pygame.image.load("imgs\\gui\\Main Menu\\rightArrow_Black.png"),\
|
||||||
|
"startButB":pygame.image.load("imgs\\gui\\Main Menu\\Start_Black.png"),"startButR": pygame.image.load("imgs\\gui\\Main Menu\\Start_Red.png"),\
|
||||||
|
"backButB":pygame.image.load("imgs\\gui\\Main Menu\\Back_Black.png"),"backButR":pygame.image.load("imgs\\gui\\Main Menu\\Back_Red.png")}
|
||||||
|
menu_dic={"main":pygame.image.load("imgs\\gui\\Main Menu\\MainMenu.png"),"create":pygame.image.load("imgs\\gui\\Main Menu\\newgame.png"),"options":pygame.image.load("imgs\\gui\\Main Menu\\options.png"),"title":pygame.image.load("imgs\\gui\\titlescreen.png")}
|
||||||
|
screen_dic={"player 2":pygame.image.load("imgs\\gui\\twoPlayer_Split.png"),"player 4":pygame.image.load("imgs\\gui\\fourPlayer_Split.png")}
|
||||||
|
compass_dic={"compassNeedle":pygame.image.load("imgs\\pickup items\\CompassNeedlePU.png"),"compassBackground":pygame.image.load("imgs\\pickup items\\CompassPU.png")}
|
||||||
|
icon_dic={"Sword":pygame.image.load("imgs\\pickup items\\ClaymorePU.png"),"StrongSword":pygame.image.load("imgs\\pickup items\\ClaymorePU.png"),"MagicStaff":pygame.image.load("imgs\\pickup items\\staffPU.png"),"Bow":pygame.image.load("imgs\\pickup items\\BowPU.png"),"Scythe":pygame.image.load("imgs\\pickup items\\ScythePU.png")}
|
||||||
|
#main dictorany
|
||||||
|
self.gui_dic={"button":button_dic,"menu":menu_dic,"screen":screen_dic,"compass":compass_dic, "icon":icon_dic}
|
||||||
|
|
||||||
|
#Health Bar dictionary
|
||||||
|
self.playericon2_dic={"Human":pygame.image.load("imgs\\healthbar\\Unarmed.png"),"Knight":pygame.image.load("imgs\\healthbar\\knight.png"),"Mage":pygame.image.load("imgs\\healthbar\\mage.png"),"Archer":pygame.image.load("imgs\\healthbar\\archer.png")}
|
||||||
|
self.playericon4_dic={"Human":pygame.image.load("imgs\\healthbar\\Unarmed4.png"),"Knight":pygame.image.load("imgs\\healthbar\\knight4.png"),"Mage":pygame.image.load("imgs\\healthbar\\mage4.png"),"Archer":pygame.image.load("imgs\\healthbar\\archer4.png")}
|
||||||
|
|
||||||
|
self.testFont = pygame.font.SysFont("Times New Roman", 12)
|
||||||
|
self.MainMenu = pygame.image.load("imgs\\gui\\Main Menu\\MainMenu.png")
|
||||||
|
self.CreateMenu = pygame.image.load("imgs\\gui\\Main Menu\\newgame.png")
|
||||||
|
self.OptionsMenu = pygame.image.load("imgs\\gui\\Main Menu\\options.png")
|
||||||
|
#self.noCoOpFont = pygame.font.Font("imgs\\gui\\HDirtyWhore-Regular", 12)
|
||||||
|
self.title_img = pygame.image.load("imgs\\gui\\titlescreen.png")
|
||||||
|
|
||||||
|
#---Input images---#
|
||||||
|
self.iconKeyboard = pygame.image.load("imgs\\gui\\Mouse and Keyboard.png")
|
||||||
|
self.iconGamepad = pygame.image.load("imgs\\gui\\Xbox_Controller.png")
|
||||||
|
#------------------#
|
||||||
|
self.Font50 = pygame.font.Font("game font\\HDirtyWhore-Regular.ttf", 50)
|
||||||
|
|
||||||
|
|
||||||
|
# Number of Windows
|
||||||
|
#self.numWindows = None
|
||||||
|
#Adjust volume
|
||||||
|
#self.appPtr.soundeffects.sounds["click1"].set_volume(1 * self.soundfx)
|
||||||
|
#self.appPtr.soundeffects.sounds["click2"].set_volume(0.3 * self.soundfx)
|
||||||
|
self.played = False
|
||||||
|
|
||||||
|
def Update(self, dT):
|
||||||
|
""" Updates the value for self.initPowerCharge
|
||||||
|
and the mouse position on the GUI. """
|
||||||
|
self.gMouse = pygame.mouse.get_pos()
|
||||||
|
self.dT = dT
|
||||||
|
return self.music
|
||||||
|
|
||||||
|
def CompassDirection(self, curPane, paneList): #Handles the direction of the compass to point to the nearest opponent.
|
||||||
|
""" Takes the positions of every player on the screen
|
||||||
|
(needs to handle the case where there is only one player),
|
||||||
|
creates vector objects between the current player and every other
|
||||||
|
player, finds the distance between every player and the current player
|
||||||
|
(call the length function of math2D), and then calls math.atan2(vectorY,
|
||||||
|
vectorX) to find the angle that we need to rotate the compass needle."""
|
||||||
|
frenemyList = [] # List of other players that you may/may not want to kill (their positions).
|
||||||
|
distanceList = [] # List of distances between yourself and every other player.
|
||||||
|
curPlayerPos = curPane.player.pos # Where you are.
|
||||||
|
if len(paneList) != 1: # If there's more than one player on screen...
|
||||||
|
for p in paneList: # For every pane...
|
||||||
|
if p != curPane and p.player.state != 2: # If it's not the pane that you are on...
|
||||||
|
frenemyList.append(p.player.pos) # Add the position of the player in that pane to frenemyList.
|
||||||
|
for frenemy in frenemyList: # For every player position in frenemyList...
|
||||||
|
curVector = frenemy - curPlayerPos # Create a vector by subtracting your position from the "frenemy"'s position.
|
||||||
|
curDistance = curVector.length() # Find the length of that vector.
|
||||||
|
distanceList.append(curDistance) # Append that length to distanceList.
|
||||||
|
i = frenemyList[distanceList.index(min(distanceList))] # Working backwards, we find the index number of the minimum value of distanceList, and we make i equal to the item in frenemyList at that same index.
|
||||||
|
closestVector = i - curPlayerPos # The closest vector is that item in frenemyList's value minus your positon.
|
||||||
|
self.compassAngle = -(math.degrees(math.atan2(closestVector[1],closestVector[0])) % 360)
|
||||||
|
else:
|
||||||
|
self.compassAngle = 90
|
||||||
|
|
||||||
|
def render(self, surf, pane = None, paneList = None):
|
||||||
|
""" surf will be the entire screen. Draw the
|
||||||
|
GUI for the current game mode. Include a check
|
||||||
|
to see if the player is currently dead. If so,
|
||||||
|
display a game over screen. """
|
||||||
|
self.mx, self.my = pygame.mouse.get_pos()
|
||||||
|
#the font size
|
||||||
|
Font20 = pygame.font.SysFont("Times New Roman", 20)
|
||||||
|
#Font21 = pygame.font.SysFont("HDirtyWhore-Regular.ttf", 20)
|
||||||
|
Font32 = pygame.font.SysFont("Times New Roman", 38)
|
||||||
|
#surf
|
||||||
|
tempS = Font20.render("Menu", False, (250,0,0))
|
||||||
|
#color
|
||||||
|
fontcolor=(255,255,255)
|
||||||
|
self.fontcolor2=fontcolor
|
||||||
|
buttoncolorhit=(255,0,255)
|
||||||
|
buttoncolor=(120,120,120)
|
||||||
|
|
||||||
|
#title page
|
||||||
|
if(self.mode == "title"):
|
||||||
|
surf.fill((128,128,128))
|
||||||
|
surf.blit(self.gui_dic["menu"]["title"], (0,0))
|
||||||
|
|
||||||
|
#menu page
|
||||||
|
elif(self.mode == "menu"):
|
||||||
|
#menu surf
|
||||||
|
MenuSurf = self.gui_dic["menu"]["main"]
|
||||||
|
tempS1 = Font20.render("create", False, fontcolor)
|
||||||
|
tempS2 = Font20.render("option", False, fontcolor)
|
||||||
|
tempS3 = Font20.render("credit", False, fontcolor)
|
||||||
|
bcolor = (128,0,0)
|
||||||
|
surf.fill(bcolor)
|
||||||
|
|
||||||
|
Y=395
|
||||||
|
X=435
|
||||||
|
#menu
|
||||||
|
surf.blit(MenuSurf, (0,0))
|
||||||
|
|
||||||
|
#create button
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+55-tempS1.get_height()/2,140, 40), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["ngamebutB"], (512-self.gui_dic["button"]["ngamebutB"].get_width()/2,Y+60-self.gui_dic["button"]["ngamebutB"].get_height()/2))
|
||||||
|
#option button
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+120-tempS2.get_height()/2,140, 40), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["optionsButB"], (512-self.gui_dic["button"]["optionsButB"].get_width()/2,Y+130-self.gui_dic["button"]["optionsButB"].get_height()/2))
|
||||||
|
#credit button
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+200-tempS3.get_height()/2,140, 40), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["creditsButB"], (512-self.gui_dic["button"]["creditsButB"].get_width()/2,Y+210-self.gui_dic["button"]["creditsButB"].get_height()/2))
|
||||||
|
|
||||||
|
#collision hit
|
||||||
|
r = pygame.Rect(((X),Y+40-tempS1.get_height()/2,155, 60))
|
||||||
|
r1 = pygame.Rect(((X),Y+110-tempS2.get_height()/2,155, 60))
|
||||||
|
r2 = pygame.Rect(((X),Y+200-self.gui_dic["button"]["creditsButB"].get_height()/2,155, 80))
|
||||||
|
|
||||||
|
#draw rectangles to screen (debug, will blit objects later)
|
||||||
|
#move with gamepad and keyboard
|
||||||
|
if(r.collidepoint(self.mx,self.my) or self.selectionV == 1 ):
|
||||||
|
self.selectionV = 1
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+40-tempS1.get_height()/2,155, 60), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["ngamebutR"], (512-self.gui_dic["button"]["ngamebutR"].get_width()/2,Y+60-self.gui_dic["button"]["ngamebutR"].get_height()/2))
|
||||||
|
if(r1.collidepoint(self.mx,self.my) or self.selectionV == 2):
|
||||||
|
self.selectionV = 2
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+110-tempS2.get_height()/2,155, 60), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["optionsButR"], (512-self.gui_dic["button"]["optionsButR"].get_width()/2,Y+130-self.gui_dic["button"]["optionsButR"].get_height()/2))
|
||||||
|
if(r2.collidepoint(self.mx,self.my) or self.selectionV == 3):
|
||||||
|
self.selectionV = 3
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X),Y+200-self.gui_dic["button"]["creditsButR"].get_height()/2,155, 80), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["creditsButR"], (512-self.gui_dic["button"]["creditsButR"].get_width()/2,Y+210-self.gui_dic["button"]["creditsButR"].get_height()/2))
|
||||||
|
#sound click
|
||||||
|
if(r.collidepoint(self.mx,self.my) or (self.selectionV == 1)):
|
||||||
|
if not self.played:
|
||||||
|
#print("hi")
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
elif(r1.collidepoint(self.mx,self.my) or (self.selectionV == 2)):
|
||||||
|
if not self.played:
|
||||||
|
#print("hi2")
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
elif(r2.collidepoint(self.mx,self.my) or (self.selectionV == 3)):
|
||||||
|
if not self.played:
|
||||||
|
#print("hi3")
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
else:
|
||||||
|
#print("hi4")
|
||||||
|
self.played = False
|
||||||
|
|
||||||
|
#credits
|
||||||
|
elif(self.mode == "credits"):
|
||||||
|
#------------------------------------------------------------------------------#
|
||||||
|
surf.fill((0,0,0))
|
||||||
|
# Initial variables
|
||||||
|
win_width=1024
|
||||||
|
win_height=768
|
||||||
|
List = ["NO COOPERATION","SPRING 2013","Thomas Edwards", "Richard Janita", "Parker Kahle",\
|
||||||
|
"Tom Paxton", "Dan Perkins", "Idris Said", "Cody Wheeler",\
|
||||||
|
"Maurice McPherson", "John Bickel", "Rhashaun Hurt",\
|
||||||
|
"Jimmy Albracht", "Ian Whitt", "Dakota Terry","Will Harmon",\
|
||||||
|
"Caleb Brown", "Matt Benson","Kris Grimsley", "Don Loughry", \
|
||||||
|
"Matt Robinson", "Cory Davis", "Joseph Brant"]
|
||||||
|
R = 255
|
||||||
|
G = 255
|
||||||
|
B = 255
|
||||||
|
Black = 0
|
||||||
|
Speed = 40 * self.dT
|
||||||
|
X = win_width // 2
|
||||||
|
Y = win_height // 2
|
||||||
|
NumSize = 30
|
||||||
|
TimesFont = pygame.font.SysFont("Times New Roman", NumSize)
|
||||||
|
self.StartY -= Speed
|
||||||
|
# Earse
|
||||||
|
surf.fill((0,0,0))
|
||||||
|
# Draw
|
||||||
|
self.DrawY = self.StartY
|
||||||
|
for i in range(len(List)):
|
||||||
|
if self.DrawY > 576 and self.DrawY < 768:
|
||||||
|
R = (768 - self.DrawY) * 1.3
|
||||||
|
G = 0
|
||||||
|
B = 0
|
||||||
|
color = (R,G,B)
|
||||||
|
elif self.DrawY > 384 and self.DrawY < 576:
|
||||||
|
R = (self.DrawY - 384) * 1.3
|
||||||
|
G = (576 - self.DrawY) * 1.3
|
||||||
|
B = 0
|
||||||
|
color = (R,G,B)
|
||||||
|
elif self.DrawY > 192 and self.DrawY < 384:
|
||||||
|
R = 0
|
||||||
|
G = (self.DrawY - 192) * 1.3
|
||||||
|
B = (384 - self.DrawY) * 1.3
|
||||||
|
color = (R, G, B)
|
||||||
|
elif self.DrawY > 0 and self.DrawY < 192: #------------------------------#
|
||||||
|
R = 0 # I had to take the inverse of
|
||||||
|
G = 0 # the inverse because otherwise
|
||||||
|
B = (self.DrawY * 1.3) # there was an odd junp between
|
||||||
|
color = (Black, Black, B) # the light blue and dark blue
|
||||||
|
else: #------------------------------#
|
||||||
|
color = (Black,Black,Black)
|
||||||
|
|
||||||
|
tempS = TimesFont.render(List[i], 1, color)
|
||||||
|
half_width = tempS.get_width() / 2
|
||||||
|
surf.blit(tempS, (X - half_width, self.DrawY))
|
||||||
|
self.DrawY += NumSize
|
||||||
|
#------------------------------------------------------------------------------#
|
||||||
|
# Flip
|
||||||
|
pygame.display.flip()
|
||||||
|
if(self.DrawY<=0):
|
||||||
|
self.mode = "menu"
|
||||||
|
|
||||||
|
|
||||||
|
#options
|
||||||
|
elif(self.mode == "options"):
|
||||||
|
#option surf
|
||||||
|
OptionSurf = self.gui_dic["menu"]["options"]
|
||||||
|
tempS6 = Font20.render(str(self.soundfx), False, fontcolor)
|
||||||
|
tempS7 = Font20.render(str(self.music), False, fontcolor)
|
||||||
|
tempS8 = Font20.render("back to menu", False, fontcolor)
|
||||||
|
bcolor = (128,0,0)
|
||||||
|
surf.fill(bcolor)
|
||||||
|
Y=450
|
||||||
|
X=440
|
||||||
|
buttoncolor = (bcolor)
|
||||||
|
surf.blit(OptionSurf, (0,0))
|
||||||
|
#audio background button
|
||||||
|
# -
|
||||||
|
pygame.draw.rect(surf, buttoncolor, ((X+2),Y+55-tempS6.get_height()/2,33, 35), 0)
|
||||||
|
#surf.blit(self.gui_dic["button"]["LArrowB"], (X+2,Y+60-self.gui_dic["button"]["LArrowB"].get_height()/2))
|
||||||
|
#num
|
||||||
|
pygame.draw.rect(surf, (0,0,0), ((X+40),Y+55-tempS6.get_height()/2,46, 35), 0)
|
||||||
|
#surf.blit(tempS6, (503-tempS6.get_width()/2,Y+61-tempS6.get_height()/2))
|
||||||
|
# +
|
||||||
|
pygame.draw.rect(surf, buttoncolor, ((X+90),Y+55-tempS6.get_height()/2,33, 35), 0)
|
||||||
|
#surf.blit(self.gui_dic["button"]["RArrowB"], (X+90,Y+60-self.gui_dic["button"]["RArrowB"].get_height()/2))
|
||||||
|
#audio music button
|
||||||
|
# +
|
||||||
|
pygame.draw.rect(surf, buttoncolor, ((X),Y+135-tempS7.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowB"], (X,Y+60-self.gui_dic["button"]["LArrowB"].get_height()/2))
|
||||||
|
#num
|
||||||
|
#pygame.draw.rect(surf, (0,0,0), ((X+38),Y+135-tempS6.get_height()/2,46, 35), 0)
|
||||||
|
surf.blit(tempS7, (503-tempS7.get_width()/2,Y+60-tempS7.get_height()/2))
|
||||||
|
# -
|
||||||
|
pygame.draw.rect(surf, buttoncolor, ((X+88),Y+135-tempS7.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowB"], (X+88,Y+60-self.gui_dic["button"]["RArrowB"].get_height()/2))
|
||||||
|
#back button
|
||||||
|
pygame.draw.rect(surf, buttoncolor, ((X+30),Y+184-tempS8.get_height()/2,64, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["backButB"], (X,Y+190-self.gui_dic["button"]["backButB"].get_height()/2))
|
||||||
|
pygame.draw.rect(surf,buttoncolor, ((X),Y,150,40))
|
||||||
|
|
||||||
|
#collision hit
|
||||||
|
r3 = pygame.Rect((X+2),Y+55-tempS6.get_height()/2,33, 35)
|
||||||
|
r4 = pygame.Rect((X+90),Y+55-tempS6.get_height()/2,33, 35)
|
||||||
|
r5 = pygame.Rect((X),Y+135-tempS7.get_height()/2,33, 35)
|
||||||
|
r14 = pygame.Rect((X+88),Y+135-tempS7.get_height()/2,33, 35)
|
||||||
|
r15 = pygame.Rect((X),Y+195-self.gui_dic["button"]["backButB"].get_height()/2,125, 50)
|
||||||
|
|
||||||
|
#right
|
||||||
|
## if(r3.collidepoint(self.mx,self.my) or (self.selectionV == 1 and self.selectionH == 1)):
|
||||||
|
## self.selectionV = 1
|
||||||
|
## self.selectionH = 1
|
||||||
|
## if not self.played:
|
||||||
|
## self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
## self.played = True
|
||||||
|
## surf.blit(self.gui_dic["button"]["LArrowR"], (X+2,Y+60-self.gui_dic["button"]["LArrowR"].get_height()/2))
|
||||||
|
#left
|
||||||
|
## if(r4.collidepoint(self.mx,self.my) or (self.selectionV == 1 and self.selectionH == 2)):
|
||||||
|
## self.selectionV = 1
|
||||||
|
## self.selectionH = 2
|
||||||
|
## if not self.played:
|
||||||
|
## self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
## self.played = True
|
||||||
|
## surf.blit(self.gui_dic["button"]["RArrowR"], (X+90,Y+60-self.gui_dic["button"]["RArrowR"].get_height()/2))
|
||||||
|
#right
|
||||||
|
if(r3.collidepoint(self.mx,self.my) or (self.selectionV == 2 and self.selectionH == 1)):
|
||||||
|
self.selectionV = 2
|
||||||
|
self.selectionH = 1
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowR"], (X+2,Y+60-self.gui_dic["button"]["LArrowR"].get_height()/2))
|
||||||
|
#left
|
||||||
|
if(r4.collidepoint(self.mx,self.my) or (self.selectionV == 2 and self.selectionH == 2)):
|
||||||
|
self.selectionV = 2
|
||||||
|
self.selectionH = 2
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowR"], (X+90,Y+60-self.gui_dic["button"]["RArrowR"].get_height()/2))
|
||||||
|
#back
|
||||||
|
if(r15.collidepoint(self.mx,self.my) or (self.selectionV == 3)):
|
||||||
|
self.selectionV = 3
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
surf.blit(self.gui_dic["button"]["backButR"], (X,Y+190-self.gui_dic["button"]["backButR"].get_height()/2))
|
||||||
|
|
||||||
|
elif(self.mode == "create"):
|
||||||
|
CreateSurf = self.gui_dic["menu"]["create"]
|
||||||
|
tempS4 = Font20.render("-", False, fontcolor)
|
||||||
|
tempS5 = Font20.render(str(self.playernum), False, fontcolor)
|
||||||
|
tempS9 = Font20.render("+", False, fontcolor)
|
||||||
|
tempS12 = Font20.render(str(self.width), False, fontcolor)
|
||||||
|
tempS13 = Font20.render(str(self.height), False, fontcolor)
|
||||||
|
tempS14 = Font20.render("start game ", False, fontcolor)
|
||||||
|
tempS15 = Font20.render("menu", False, fontcolor)
|
||||||
|
Y=365
|
||||||
|
X=455
|
||||||
|
bcolor = (128,0,0)
|
||||||
|
surf.fill(bcolor)
|
||||||
|
surf.blit(CreateSurf, (0,0))
|
||||||
|
#player
|
||||||
|
#----------------------------------------------------------------------------------#
|
||||||
|
#left
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowB"], ((X-21),Y+139-tempS4.get_height()/2,33, 35))
|
||||||
|
#num
|
||||||
|
pygame.draw.rect(surf, (0,0,0), ((X+18),Y+135-tempS5.get_height()/2,43,35), 0)
|
||||||
|
surf.blit(tempS5, (493-tempS5.get_width()/2,Y+140-tempS5.get_height()/2))
|
||||||
|
#right
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowB"], ((X+67),Y+139-tempS5.get_height()/2,33,35))
|
||||||
|
#----------------------------------------------------------------------------------#
|
||||||
|
#size
|
||||||
|
#----------------------------------------------------------------------------------#
|
||||||
|
#left
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X+28),Y+215-tempS4.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowB"], ((X+28),Y+220-tempS4.get_height()/2,33, 35))
|
||||||
|
#num
|
||||||
|
pygame.draw.rect(surf, (0,0,0), ((X+68),Y+215-tempS4.get_height()/2,39, 35), 0)
|
||||||
|
surf.blit(tempS12, (540-tempS4.get_width()/2,Y+220-tempS4.get_height()/2))
|
||||||
|
#Right
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X+116),Y+215-tempS4.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowB"], ((X+116),Y+220-tempS4.get_height()/2,33, 35))
|
||||||
|
#left
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X+29),Y+269-tempS4.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowB"], ((X+29),Y+273-tempS4.get_height()/2,33, 35))
|
||||||
|
#num
|
||||||
|
pygame.draw.rect(surf, (0,0,0), ((X+69),Y+270-tempS4.get_height()/2,39, 35), 0)
|
||||||
|
surf.blit(tempS13, (541-tempS4.get_width()/2,Y+275-tempS4.get_height()/2))
|
||||||
|
#right
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X+117),Y+268-tempS4.get_height()/2,33, 35), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowB"], ((X+117),Y+273-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
#----------------------------------------------------------------------------------#
|
||||||
|
|
||||||
|
#start
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X - 65),Y+325-self.gui_dic["button"]["startButB"].get_height()/2,125, 65), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["startButB"], (450-self.gui_dic["button"]["startButB"].get_width()/2,Y+330-self.gui_dic["button"]["startButB"].get_height()/2))
|
||||||
|
#back
|
||||||
|
pygame.draw.rect(surf, (bcolor), ((X+65),Y+315-tempS5.get_height()/2,125,55), 0)
|
||||||
|
surf.blit(self.gui_dic["button"]["backButB"], (582-self.gui_dic["button"]["backButB"].get_width()/2,Y+330-self.gui_dic["button"]["backButB"].get_height()/2))
|
||||||
|
#collision hit
|
||||||
|
#player
|
||||||
|
r6 = pygame.Rect((X-21),Y+135-tempS4.get_height()/2,33, 35)
|
||||||
|
r7 = pygame.Rect((X+67),Y+135-tempS5.get_height()/2,33,35)
|
||||||
|
#size
|
||||||
|
r8 = pygame.Rect((X+28),Y+215-tempS4.get_height()/2,33, 35)
|
||||||
|
r9 = pygame.Rect((X+116),Y+215-tempS4.get_height()/2,33, 35)
|
||||||
|
r10 = pygame.Rect((X+117),Y+268-tempS4.get_height()/2,33, 35)
|
||||||
|
r11 = pygame.Rect((X+29),Y+269-tempS4.get_height()/2,33, 35)
|
||||||
|
#start
|
||||||
|
r12 = pygame.Rect((X - 65),Y+325-self.gui_dic["button"]["startButB"].get_height()/2,125, 65)
|
||||||
|
#end
|
||||||
|
r13 = pygame.Rect((X+65),Y+315-tempS5.get_height()/2,125,55)
|
||||||
|
|
||||||
|
#player number
|
||||||
|
if(r6.collidepoint(self.mx,self.my) or (self.selectionV == 1 and self.selectionH == 1)):
|
||||||
|
#print("R6")
|
||||||
|
self.selectionV = 1
|
||||||
|
self.selectionH = 1
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#right
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowR"], ((X-21),Y+139-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
if(r7.collidepoint(self.mx,self.my) or (self.selectionV == 1 and self.selectionH == 2)):
|
||||||
|
#print("R7")
|
||||||
|
self.selectionV = 1
|
||||||
|
self.selectionH = 2
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#left
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowR"], ((X+67),Y+139-tempS5.get_height()/2,33,35))
|
||||||
|
|
||||||
|
#width
|
||||||
|
if(r8.collidepoint(self.mx,self.my) or (self.selectionV == 2 and self.selectionH == 1)):
|
||||||
|
#print("R8")
|
||||||
|
self.selectionV = 2
|
||||||
|
self.selectionH = 1
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#left
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowR"], ((X+28),Y+220-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
if(r9.collidepoint(self.mx,self.my) or (self.selectionV == 2 and self.selectionH == 2)):
|
||||||
|
#print("R9")
|
||||||
|
self.selectionV = 2
|
||||||
|
self.selectionH = 2
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#right
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowR"], ((X+116),Y+220-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
#height
|
||||||
|
if(r11.collidepoint(self.mx,self.my) or (self.selectionV == 3 and self.selectionH == 1)):
|
||||||
|
#print("R10")
|
||||||
|
self.selectionV = 3
|
||||||
|
self.selectionH = 1
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#right
|
||||||
|
surf.blit(self.gui_dic["button"]["LArrowR"], ((X+29),Y+273-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
if(r10.collidepoint(self.mx,self.my) or (self.selectionV == 3 and self.selectionH == 2)):
|
||||||
|
#print("R11")
|
||||||
|
self.selectionV = 3
|
||||||
|
self.selectionH = 2
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#left
|
||||||
|
surf.blit(self.gui_dic["button"]["RArrowR"], ((X+117),Y+273-tempS4.get_height()/2,33, 35))
|
||||||
|
|
||||||
|
#start game and back
|
||||||
|
if(r12.collidepoint(self.mx,self.my) or (self.selectionV == 4 and self.selectionH == 1)):
|
||||||
|
#print("R12")
|
||||||
|
self.selectionV = 4
|
||||||
|
self.selectionH = 1
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#start
|
||||||
|
surf.blit(self.gui_dic["button"]["startButR"], (450-self.gui_dic["button"]["startButR"].get_width()/2,Y+330-self.gui_dic["button"]["startButR"].get_height()/2))
|
||||||
|
|
||||||
|
if(r13.collidepoint(self.mx,self.my) or (self.selectionV == 4 and self.selectionH == 2)):
|
||||||
|
#print("R13")
|
||||||
|
self.selectionV = 4
|
||||||
|
self.selectionH = 2
|
||||||
|
if not self.played:
|
||||||
|
self.appPtr.soundeffects.sounds["click1"].play()
|
||||||
|
self.played = True
|
||||||
|
#back
|
||||||
|
surf.blit(self.gui_dic["button"]["backButR"], (582-self.gui_dic["button"]["backButR"].get_width()/2,Y+330-self.gui_dic["button"]["backButR"].get_height()/2))
|
||||||
|
|
||||||
|
|
||||||
|
elif(self.mode == "input"):
|
||||||
|
for i in range(self.playernum):
|
||||||
|
if i == pane.paneNum:
|
||||||
|
if i < len(self.mapping):
|
||||||
|
surf.fill((128,0,0))
|
||||||
|
#if(i == len(self.mapping) - 1):
|
||||||
|
# print("Self.Mapping: ", len(self.mapping) - 1)
|
||||||
|
if(self.mapping[i][1] == 0):
|
||||||
|
surf.blit(self.iconKeyboard, (50, 50))
|
||||||
|
else:
|
||||||
|
#print("Gamepad Draw", len(self.mapping))
|
||||||
|
surf.blit(self.iconGamepad, (50, 50))
|
||||||
|
else:
|
||||||
|
surf.fill((255,255,255))
|
||||||
|
|
||||||
|
#--MESSAGE--#
|
||||||
|
tempS20 = self.Font50.render("Press Attack After", False, self.fontcolor2)
|
||||||
|
tempS21 = self.Font50.render("Everyone Enters", False, self.fontcolor2)
|
||||||
|
surf.blit(tempS20, (50, 150))
|
||||||
|
surf.blit(tempS21, (50, 210))
|
||||||
|
#-----------#
|
||||||
|
|
||||||
|
elif(self.mode =="game"):
|
||||||
|
if len(paneList) == 1:
|
||||||
|
# Circle Alpha Cutout!
|
||||||
|
|
||||||
|
tempSurf = pygame.Surface((64,64))
|
||||||
|
circleCutout = pygame.Surface((64,64))
|
||||||
|
circleCutout.fill((0,0,0))
|
||||||
|
pygame.draw.circle(circleCutout, (254,254,254), (32,32), 32) # Border (optional)
|
||||||
|
pygame.draw.circle(circleCutout, (255,255,255), (32,32), 31) # Must be white for the color key
|
||||||
|
circleCutout.set_colorkey((255,255,255))
|
||||||
|
tempSurf.fill((0,0,0))
|
||||||
|
# POWER ATTACK BAR (BLIT WEAPON ICON IN FRONT OF THIS!!!)
|
||||||
|
pygame.draw.rect(tempSurf, (self.pAttackColor), (0, 64, 64,64 * -(pane.player.paCharge)))
|
||||||
|
# Blits the Cutout!
|
||||||
|
|
||||||
|
tempSurf.blit(circleCutout, (0,0))
|
||||||
|
tempSurf.set_colorkey((0,0,0)) # Make border areas outside the circle transparent
|
||||||
|
surf.blit(tempSurf, (2, 702)) # Copy the completed overlay to the screen
|
||||||
|
surf.blit(self.gui_dic["icon"][pane.player.weapon[0]], (18,718))
|
||||||
|
|
||||||
|
# ATTACK AND POWERATTACK BUTTON INDICATORS
|
||||||
|
pygame.draw.rect(surf, (0,255,0), (surf.get_width() - (surf.get_width() - 66), surf.get_height() - 67, surf.get_width() // 30, surf.get_height() // 20))
|
||||||
|
pygame.draw.rect(surf, (255,0,0), (surf.get_width() - (surf.get_width() - 66), surf.get_height() - 35, surf.get_width() // 30, surf.get_height() // 20))
|
||||||
|
surf.blit(self.testFont.render("ATK", False, (0,0,0)), (surf.get_width() - (surf.get_width() - 72), surf.get_height() - 60))
|
||||||
|
surf.blit(self.testFont.render("PWR", False, (0,0,0)), (surf.get_width() - (surf.get_width() - 70), surf.get_height() - 23))
|
||||||
|
|
||||||
|
# HEALTH BAR
|
||||||
|
p2x = 111 + (pane.player.health*2)
|
||||||
|
bPL = ((111, 63), (309, 63), (283, 89), (81, 89))
|
||||||
|
rPL = ((111, 65), (304, 65), (282, 87), (87, 87))
|
||||||
|
gPL = ((111, 65), (p2x, 65), ((p2x-22), 87), (87, 87))
|
||||||
|
pPL = ((36, 57), (116, 57), (80, 93), (46, 93), (16, 68))
|
||||||
|
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), bPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(255,0,0),rPL , 0)
|
||||||
|
pygame.draw.polygon(surf,(111,111,111), pPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), pPL, 3)
|
||||||
|
pygame.draw.polygon(surf,(0,255,0), gPL, 0)
|
||||||
|
surf.blit(self.playericon2_dic[pane.player.name], (0,0))
|
||||||
|
|
||||||
|
# COMPASS
|
||||||
|
self.CompassDirection(pane, paneList)
|
||||||
|
surf.blit(self.gui_dic["compass"]["compassBackground"], (surf.get_width() - 64, surf.get_height() - 64))
|
||||||
|
tempS = pygame.transform.rotate(self.gui_dic["compass"]["compassNeedle"], self.compassAngle)
|
||||||
|
surf.blit(tempS, (surf.get_width() - 32 - tempS.get_width() / 2, surf.get_height() - 32 - tempS.get_height()/2))
|
||||||
|
|
||||||
|
elif len(paneList) == 2:
|
||||||
|
# Check to see if the game has ended.
|
||||||
|
if len(self.amongTheLiving) <= 1:
|
||||||
|
self.mode == "GameOver"
|
||||||
|
# Circle Alpha Cutout!
|
||||||
|
|
||||||
|
tempSurf = pygame.Surface((64,64))
|
||||||
|
circleCutout = pygame.Surface((64,64))
|
||||||
|
circleCutout.fill((0,0,0))
|
||||||
|
pygame.draw.circle(circleCutout, (254,254,254), (32,32), 32) # Border (optional)
|
||||||
|
pygame.draw.circle(circleCutout, (255,255,255), (32,32), 31) # Must be white for the color key
|
||||||
|
circleCutout.set_colorkey((255,255,255))
|
||||||
|
tempSurf.fill((0,0,0))
|
||||||
|
# POWER ATTACK BAR (BLIT WEAPON ICON IN FRONT OF THIS!!!)
|
||||||
|
pygame.draw.rect(tempSurf, (self.pAttackColor), (0, 64, 64,64 * -(pane.player.paCharge)))
|
||||||
|
# Blits the Cutout!
|
||||||
|
|
||||||
|
tempSurf.blit(circleCutout, (0,0)) # REMEMBER: 18, 358 AND 2, 326
|
||||||
|
tempSurf.set_colorkey((0,0,0)) # Make border areas outside the circle transparent
|
||||||
|
surf.blit(tempSurf, (2, 702)) # Copy the completed overlay to the screen
|
||||||
|
surf.blit(self.gui_dic["icon"][pane.player.weapon[0]], (18,718))
|
||||||
|
# ATTACK AND POWERATTACK BUTTON INDICATORS
|
||||||
|
pygame.draw.rect(surf, (0,255,0), (62, surf.get_height() - 33, 30, 30))
|
||||||
|
pygame.draw.rect(surf, (255,0,0), (62, surf.get_height() - 63, 30, 30))
|
||||||
|
surf.blit(self.testFont.render("ATK", False, (0,0,0)), (66, surf.get_height() - 55))
|
||||||
|
surf.blit(self.testFont.render("PWR", False, (0,0,0)), (64, surf.get_height() - 25))
|
||||||
|
|
||||||
|
# HEALTH BAR
|
||||||
|
p2x = 111 + (pane.player.health*2)
|
||||||
|
bPL = ((111, 63), (309, 63), (283, 89), (81, 89))
|
||||||
|
rPL = ((111, 65), (304, 65), (282, 87), (87, 87))
|
||||||
|
gPL = ((111, 65), (p2x, 65), ((p2x-22), 87), (87, 87))
|
||||||
|
pPL = ((36, 57), (116, 57), (80, 93), (46, 93), (16, 68))
|
||||||
|
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), bPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(255,0,0),rPL , 0)
|
||||||
|
pygame.draw.polygon(surf,(111,111,111), pPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), pPL, 3)
|
||||||
|
pygame.draw.polygon(surf,(0,255,0), gPL, 0)
|
||||||
|
surf.blit(self.playericon2_dic[pane.player.name], (0,0))
|
||||||
|
|
||||||
|
# COMPASS
|
||||||
|
self.CompassDirection(pane, paneList)
|
||||||
|
surf.blit(self.gui_dic["compass"]["compassBackground"], (surf.get_width() - 64, surf.get_height() - 64))
|
||||||
|
tempS = pygame.transform.rotate(self.gui_dic["compass"]["compassNeedle"], self.compassAngle)
|
||||||
|
surf.blit(tempS, (surf.get_width() - 32 - tempS.get_width() / 2, surf.get_height() - 32 - tempS.get_height()/2))
|
||||||
|
|
||||||
|
else:
|
||||||
|
# Circle Alpha Cutout!
|
||||||
|
|
||||||
|
tempSurf = pygame.Surface((64,64))
|
||||||
|
circleCutout = pygame.Surface((64,64))
|
||||||
|
circleCutout.fill((0,0,0))
|
||||||
|
pygame.draw.circle(circleCutout, (254,254,254), (32,32), 32) # Border (optional)
|
||||||
|
pygame.draw.circle(circleCutout, (255,255,255), (32,32), 31) # Must be white for the color key
|
||||||
|
circleCutout.set_colorkey((255,255,255))
|
||||||
|
tempSurf.fill((0,0,0))
|
||||||
|
# POWER ATTACK BAR (BLIT WEAPON ICON IN FRONT OF THIS!!!)
|
||||||
|
pygame.draw.rect(tempSurf, (self.pAttackColor), (0, 64, 64,64 * -(pane.player.paCharge)))
|
||||||
|
# Blits the Cutout!
|
||||||
|
|
||||||
|
tempSurf.blit(circleCutout, (0,0)) # REMEMBER: 18, 358 AND 2, 326
|
||||||
|
tempSurf.set_colorkey((0,0,0)) # Make border areas outside the circle transparent
|
||||||
|
surf.blit(tempSurf, (2, 316)) # Copy the completed overlay to the screen
|
||||||
|
surf.blit(self.gui_dic["icon"][pane.player.weapon[0]], (18,334))
|
||||||
|
|
||||||
|
|
||||||
|
#surf.blit(self.gui_dic["icon"][pane.player.weapon[0]], (10, 340))
|
||||||
|
# ATTACK AND POWERATTACK BUTTON INDICATORS
|
||||||
|
pygame.draw.rect(surf, (0,255,0), (surf.get_width() - (surf.get_width() - 64), surf.get_height() - 61, 25, 25))
|
||||||
|
pygame.draw.rect(surf, (255,0,0), (surf.get_width() - (surf.get_width() - 64), surf.get_height() - 36, 25, 25))
|
||||||
|
surf.blit(self.testFont.render("ATK", False, (0,0,0)), (surf.get_width() - (surf.get_width() - 64), surf.get_height() - 58))
|
||||||
|
surf.blit(self.testFont.render("PWR", False, (0,0,0)), (surf.get_width() - (surf.get_width() - 64), surf.get_height() - 31))
|
||||||
|
|
||||||
|
# HEALTH BAR
|
||||||
|
p2x = 94 + (pane.player.health*1.8)
|
||||||
|
bPL = ((92, 48), (279, 48), (259, 68), (72, 68))
|
||||||
|
rPL = ((94, 50), (274, 50), (258, 66), (78, 66))
|
||||||
|
gPL = ((94, 50), (p2x, 50), ((p2x-16), 66), (78, 66))
|
||||||
|
pPL = ((33, 42), (99, 42), (69, 72), (41, 72), (16, 52))
|
||||||
|
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), bPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(255,0,0),rPL , 0)
|
||||||
|
pygame.draw.polygon(surf,(111,111,111), pPL, 0)
|
||||||
|
pygame.draw.polygon(surf,(0,0,0), pPL, 3)
|
||||||
|
pygame.draw.polygon(surf,(0,255,0), gPL, 0)
|
||||||
|
surf.blit(self.playericon4_dic[pane.player.name], (0,0))
|
||||||
|
|
||||||
|
# COMPASS
|
||||||
|
self.CompassDirection(pane, paneList)
|
||||||
|
surf.blit(self.gui_dic["compass"]["compassBackground"], (surf.get_width() - 64, surf.get_height() - 64))
|
||||||
|
tempS = pygame.transform.rotate(self.gui_dic["compass"]["compassNeedle"], self.compassAngle)
|
||||||
|
surf.blit(tempS, (surf.get_width() - 32 - tempS.get_width() / 2, surf.get_height() - 32 - tempS.get_height()/2))
|
||||||
|
|
||||||
|
elif self.mode == "GameOver":
|
||||||
|
gameOverSurf = pygame.image.load("")
|
||||||
|
surf.fill(255,0,0)
|
||||||
|
|
||||||
|
def handleMovement(self, horiz, vert):
|
||||||
|
""" horiz and vert are in the range -1...+1.
|
||||||
|
This method only changes the state of self.selection, which
|
||||||
|
should be used in the render method to determine which box is
|
||||||
|
currently being highlighted. """
|
||||||
|
#input for title
|
||||||
|
if( self.mode == "title"):
|
||||||
|
self.selectionV = 1 # If the player goes back to the main screen, the selection variable resets to 1.
|
||||||
|
|
||||||
|
#input for input
|
||||||
|
elif( self.mode == "input"):
|
||||||
|
self.selectionV = 1
|
||||||
|
|
||||||
|
#input for menu
|
||||||
|
elif( self.mode == "menu"):
|
||||||
|
if( vert == 1):
|
||||||
|
self.selectionV += 1
|
||||||
|
elif( vert == -1):
|
||||||
|
self.selectionV -= 1
|
||||||
|
if( self.selectionV > 3):
|
||||||
|
self.selectionV = 1
|
||||||
|
elif( self.selectionV < 1):
|
||||||
|
self.selectionV = 3
|
||||||
|
|
||||||
|
#input for options
|
||||||
|
elif( self.mode == "options"):
|
||||||
|
if( vert == 1 ):
|
||||||
|
self.selectionV += 1
|
||||||
|
elif( vert == -1):
|
||||||
|
self.selectionV -= 1
|
||||||
|
if( horiz == 1 ):
|
||||||
|
self.selectionH += 1
|
||||||
|
elif( horiz == -1):
|
||||||
|
self.selectionH -= 1
|
||||||
|
if( self.selectionH > 2): # This assumes that the "create game" screen has three options and a "back" button, lined up vertically. 1 3
|
||||||
|
self.selectionH = 1 # Additional conditional statements may be needed: i.e. if self.selection == 2 and horiz == 1: self.selection = 4, assuming a grid of 2 4.
|
||||||
|
elif( self.selectionH < 1):
|
||||||
|
self.selectionH = 2
|
||||||
|
if( self.selectionV > 3): # This assumes that the "create game" screen has three options and a "back" button, lined up vertically. 1 3
|
||||||
|
self.selectionV = 1 # Additional conditional statements may be needed: i.e. if self.selection == 2 and horiz == 1: self.selection = 4, assuming a grid of 2 4.
|
||||||
|
elif( self.selectionV < 1):
|
||||||
|
self.selectionV = 3
|
||||||
|
|
||||||
|
#input for create
|
||||||
|
elif(self.mode == "create"):
|
||||||
|
if( vert == 1 ):
|
||||||
|
self.selectionV += 1
|
||||||
|
elif( vert == -1):
|
||||||
|
self.selectionV -= 1
|
||||||
|
if( horiz == 1 ):
|
||||||
|
self.selectionH += 1
|
||||||
|
elif( horiz == -1):
|
||||||
|
self.selectionH -= 1
|
||||||
|
if( self.selectionH > 2): # This assumes that the "create game" screen has three options and a "back" button, lined up vertically. 1 3
|
||||||
|
self.selectionH = 1 # Additional conditional statements may be needed: i.e. if self.selection == 2 and horiz == 1: self.selection = 4, assuming a grid of 2 4.
|
||||||
|
elif( self.selectionH < 1):
|
||||||
|
self.selectionH = 2
|
||||||
|
if( self.selectionV > 4): # This assumes that the "create game" screen has three options and a "back" button, lined up vertically. 1 3
|
||||||
|
self.selectionV = 1 # Additional conditional statements may be needed: i.e. if self.selection == 2 and horiz == 1: self.selection = 4, assuming a grid of 2 4.
|
||||||
|
elif( self.selectionV < 1):
|
||||||
|
self.selectionV = 4
|
||||||
|
|
||||||
|
def handleAction(self, action, gamepad):
|
||||||
|
""" action will be one of 'attack',
|
||||||
|
'pattack', 'interact', 'use', '?'. Possibly
|
||||||
|
change the GUI mode, etc. The return
|
||||||
|
value should be 1, 2, 3, or 4 iff we're
|
||||||
|
in 'create' screen and we've hit the
|
||||||
|
'start' button. In all other cases, it should
|
||||||
|
be None """
|
||||||
|
rv={}
|
||||||
|
#title
|
||||||
|
#print(action)
|
||||||
|
if(self.mode == "title"):
|
||||||
|
if(self.selectionV == 1 and action == "attack"):
|
||||||
|
self.appPtr.soundeffects.sounds["click2"].play()
|
||||||
|
self.mode = "menu"
|
||||||
|
if(self.selectionV == 1 and action == "pattack"):
|
||||||
|
rv["player"] = 1
|
||||||
|
rv["dim"] = (4,4)
|
||||||
|
#soundDataBase.SoundDBase.sounds["click2"].play()
|
||||||
|
self.appPtr.soundeffects.sounds["click2"].play()
|
||||||
|
self.mode = "game"
|
||||||
|
pygame.mixer.music.fadeout(1000) #Stops the title song
|
||||||
|
#return rv
|
||||||
|
|
||||||
|
#menu
|
||||||
|
elif(self.mode == "menu"):
|
||||||
|
if(self.selectionV == 1 and action == "attack"):
|
||||||
|
self.appPtr.soundeffects.sounds["click2"].play()
|
||||||
|
self.mode = "create"
|
||||||
|
elif(self.selectionV == 2 and action == "attack"):
|
||||||
|
self.appPtr.soundeffects.sounds["click2"].play()
|
||||||
|
self.mode = "options"
|
||||||
|
elif(self.selectionV == 3 and action == "attack"):
|
||||||
|
self.appPtr.soundeffects.sounds["click2"].play()
|
||||||
|
self.mode = "credits"
|
||||||
|
self.StartY = 768
|
||||||
|
|
||||||
|
#input
|
||||||
|
elif(self.mode == "input"):
|
||||||
|
|
||||||
|
if action == "attack":
|
||||||
|
if len(self.mapping) == self.playernum:
|
||||||
|
rv["player"] = self.playernum
|
||||||
|
rv["dim"] = (self.width,self.height)
|
||||||
|
rv["mapping"] = self.mapping
|
||||||
|
self.mode = "game"
|
||||||
|
pygame.mixer.music.fadeout(1000) #Stops the title song
|
||||||
|
return rv
|
||||||
|
|
||||||
|
in_list = False
|
||||||
|
for m in self.mapping:
|
||||||
|
if m[1] == gamepad:
|
||||||
|
in_list = True
|
||||||
|
break
|
||||||
|
if not in_list:
|
||||||
|
#print("Adding ", gamepad, "to mapping number")
|
||||||
|
mappingNum = len(self.mapping)
|
||||||
|
self.mapping.append([mappingNum, gamepad])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#create menu
|
||||||
|
elif(self.mode == "create"):
|
||||||
|
if(self.selectionV == 1):
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.playernum -= 1
|
||||||
|
if(self.playernum < 1):
|
||||||
|
self.playernum = pygame.joystick.get_count() + 1
|
||||||
|
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.playernum += 1
|
||||||
|
if(self.playernum > pygame.joystick.get_count() + 1):
|
||||||
|
self.playernum = 1
|
||||||
|
|
||||||
|
elif(self.selectionV == 2):
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.width -= 1
|
||||||
|
if(self.width < 4):
|
||||||
|
self.width = 10
|
||||||
|
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.width += 1
|
||||||
|
if(self.width > 10):
|
||||||
|
self.width = 4
|
||||||
|
|
||||||
|
elif(self.selectionV == 3):
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.height -= 1
|
||||||
|
if(self.height < 4):
|
||||||
|
self.height = 10
|
||||||
|
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.height += 1
|
||||||
|
if(self.height > 10):
|
||||||
|
self.height = 4
|
||||||
|
|
||||||
|
elif(self.selectionV == 4):
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.mode = "input"
|
||||||
|
self.selectionV = 1
|
||||||
|
rv["player"] = self.playernum
|
||||||
|
rv["dim"] = (self.width,self.height)
|
||||||
|
rv["mapping"] = [[0,0], [1,0], [2,0], [3,0]]
|
||||||
|
return rv
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.mode = "menu"
|
||||||
|
|
||||||
|
#options menu
|
||||||
|
elif(self.mode == "options"):
|
||||||
|
#BACKGORUND
|
||||||
|
if(self.selectionV == 1):
|
||||||
|
#+
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.soundfx += 1
|
||||||
|
if(self.soundfx > 10):
|
||||||
|
self.soundfx = 0
|
||||||
|
#-
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.soundfx -= 1
|
||||||
|
if(self.soundfx < 0):
|
||||||
|
self.soundfx=0
|
||||||
|
|
||||||
|
elif(self.selectionV == 2):
|
||||||
|
if(self.selectionH == 1 and action == "attack"):
|
||||||
|
self.music -= 1
|
||||||
|
if(self.music < 0):
|
||||||
|
self.music = 10
|
||||||
|
|
||||||
|
if(self.selectionH == 2 and action == "attack"):
|
||||||
|
self.music += 1
|
||||||
|
if(self.music > 10):
|
||||||
|
self.music = 10
|
||||||
|
pygame.mixer.music.set_volume(self.music / 10)
|
||||||
|
|
||||||
|
elif(self.selectionV == 3 and action == "attack"):
|
||||||
|
self.mode = "menu"
|
||||||
|
|
||||||
|
#credit scene
|
||||||
|
elif(self.mode == "credits"):
|
||||||
|
if(action == "attack"):
|
||||||
|
self.mode = "menu"
|
167
idevice.py
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
import pygame
|
||||||
|
import application
|
||||||
|
|
||||||
|
class IDevice(object):
|
||||||
|
""" A Generic input device. We will define classes that
|
||||||
|
inherit from this. """
|
||||||
|
deadZone = 0.1
|
||||||
|
|
||||||
|
def __init__(self):
|
||||||
|
self.horiz = 0.0 # Movement in the x-direction [-1.0 ... 1.0]
|
||||||
|
self.vert = 0.0 # ................y-........................
|
||||||
|
self.actions = {"attack" : False,
|
||||||
|
"pattack" : False,
|
||||||
|
"weapon swap" : False,
|
||||||
|
"use powerup" : False
|
||||||
|
}
|
||||||
|
|
||||||
|
def update(self, eList, app):
|
||||||
|
""" Check for change of state """
|
||||||
|
pass
|
||||||
|
|
||||||
|
class Gamepad(IDevice):
|
||||||
|
""" Controls input from 360 controller. Derived from IDevice class."""
|
||||||
|
def __init__(self, controllerNumber):
|
||||||
|
IDevice.__init__(self)
|
||||||
|
self.gamepad = pygame.joystick.Joystick(controllerNumber)
|
||||||
|
self.gamepad.init()
|
||||||
|
self.buttonIDs = [0,1,2,3,(0,1),(1,0),(-1,0),(0,-1)]
|
||||||
|
self.value = 0 # temp
|
||||||
|
|
||||||
|
self.id = controllerNumber + 1
|
||||||
|
print(self.id)
|
||||||
|
def update(self, eList, app):
|
||||||
|
self.horiz = self.gamepad.get_axis(0)
|
||||||
|
self.vert = self.gamepad.get_axis(1)
|
||||||
|
#app.onMovement(self.horiz, self.vert)
|
||||||
|
if abs(self.horiz) <= IDevice.deadZone and abs(self.vert) <= IDevice.deadZone:
|
||||||
|
self.horiz, self.vert = self.gamepad.get_hat(0)
|
||||||
|
self.vert = -(self.vert)
|
||||||
|
if abs(self.horiz) <= IDevice.deadZone and abs(self.vert) <= IDevice.deadZone:
|
||||||
|
self.horiz = 0
|
||||||
|
self.vert = 0
|
||||||
|
|
||||||
|
for e in eList:
|
||||||
|
if e.type == pygame.JOYAXISMOTION:
|
||||||
|
#print(e.joy, e.axis, e.value)
|
||||||
|
pass
|
||||||
|
#if e.value >= 0.6 or e.value <= -0.6:
|
||||||
|
#if self.horiz >= 0.6 or self.horiz <= -0.6 or \
|
||||||
|
# self.vert >= 0.6 or self.vert <= -0.6:
|
||||||
|
# app.onMovement(self.horiz, self.vert)
|
||||||
|
#Trigger Attack Buttons
|
||||||
|
if self.gamepad.get_axis(2) <= -0.5:
|
||||||
|
self.actions["attack"] = True
|
||||||
|
if self.gamepad.get_axis(2) >= 0.5:
|
||||||
|
self.actions["pattack"] = True
|
||||||
|
if not self.gamepad.get_button(0):
|
||||||
|
self.actions["attack"] = False
|
||||||
|
if not self.gamepad.get_button(1):
|
||||||
|
self.actions["pattack"] = False
|
||||||
|
|
||||||
|
if e.type == pygame.JOYBUTTONDOWN:
|
||||||
|
if self.gamepad.get_button(5):
|
||||||
|
self.actions["attack"] = True
|
||||||
|
#print("attack")
|
||||||
|
app.onAction("attack", self.id)
|
||||||
|
#print("0, Attack")
|
||||||
|
if self.gamepad.get_button(4):
|
||||||
|
self.actions["pattack"] = True
|
||||||
|
app.onAction("pattack", self.id)
|
||||||
|
#print("1, P-Attack")
|
||||||
|
if self.gamepad.get_button(2):
|
||||||
|
self.actions["weapon swap"] = True
|
||||||
|
#print("2, weapon swap")
|
||||||
|
if self.gamepad.get_button(3):
|
||||||
|
self.actions["use powerup"] = True
|
||||||
|
#print("3, Use Powerup")
|
||||||
|
|
||||||
|
elif e.type == pygame.JOYBUTTONUP:
|
||||||
|
#if not self.gamepad.get_button(0):
|
||||||
|
if e.button == 5:
|
||||||
|
self.actions["attack"] = False
|
||||||
|
if e.button == 4:
|
||||||
|
self.actions["pattack"] = False
|
||||||
|
if e.button == 2:
|
||||||
|
self.actions["weapon swap"] = False
|
||||||
|
if e.button == 3:
|
||||||
|
self.actions["use powerup"] = False
|
||||||
|
|
||||||
|
elif e.type == pygame.JOYHATMOTION:
|
||||||
|
app.onMovement(e.value[0], -e.value[1])
|
||||||
|
|
||||||
|
class Keyboard(IDevice):
|
||||||
|
""" Controls input from keyboard and mouse. Derived from IDevice class."""
|
||||||
|
def __init__(self):
|
||||||
|
IDevice.__init__(self)
|
||||||
|
|
||||||
|
def update(self, eList, app):
|
||||||
|
keysPressed = pygame.key.get_pressed()
|
||||||
|
if keysPressed[pygame.K_LEFT] or keysPressed[pygame.K_a]:
|
||||||
|
self.horiz = -1
|
||||||
|
|
||||||
|
elif keysPressed[pygame.K_RIGHT] or keysPressed[pygame.K_d]:
|
||||||
|
self.horiz = 1
|
||||||
|
else:
|
||||||
|
self.horiz = 0
|
||||||
|
|
||||||
|
if keysPressed[pygame.K_UP] or keysPressed[pygame.K_w]:
|
||||||
|
self.vert = -1
|
||||||
|
|
||||||
|
elif keysPressed[pygame.K_DOWN] or keysPressed[pygame.K_s]:
|
||||||
|
self.vert = 1
|
||||||
|
else:
|
||||||
|
self.vert = 0
|
||||||
|
|
||||||
|
for e in eList:
|
||||||
|
if e.type == pygame.KEYDOWN:
|
||||||
|
if e.key == pygame.K_LEFT or e.key == pygame.K_a:
|
||||||
|
app.onMovement(self.horiz, self.vert)
|
||||||
|
|
||||||
|
if e.key == pygame.K_RIGHT or e.key == pygame.K_d:
|
||||||
|
app.onMovement(self.horiz, self.vert)
|
||||||
|
|
||||||
|
if e.key == pygame.K_UP or e.key == pygame.K_w:
|
||||||
|
app.onMovement(self.horiz, self.vert)
|
||||||
|
|
||||||
|
if e.key == pygame.K_DOWN or e.key == pygame.K_s:
|
||||||
|
app.onMovement(self.horiz, self.vert)
|
||||||
|
|
||||||
|
if e.key == pygame.K_f:
|
||||||
|
self.actions["weapon swap"] = True
|
||||||
|
|
||||||
|
if e.key == pygame.K_e:
|
||||||
|
self.actions["use powerup"] = True
|
||||||
|
app.onAction("use powerup", 0)
|
||||||
|
|
||||||
|
if e.key == pygame.K_SPACE:
|
||||||
|
app.onAction("attack", 0)
|
||||||
|
if e.key == pygame.K_RETURN:
|
||||||
|
app.onAction("pattack", 0)
|
||||||
|
|
||||||
|
if e.key == pygame.K_r:
|
||||||
|
app.refresh()
|
||||||
|
|
||||||
|
if e.type == pygame.MOUSEBUTTONDOWN:
|
||||||
|
|
||||||
|
if e.button == 1:
|
||||||
|
self.actions["attack"] = True
|
||||||
|
app.onAction("attack", 0)
|
||||||
|
|
||||||
|
if e.button == 3:
|
||||||
|
self.actions["pattack"] = True
|
||||||
|
app.onAction("pattack", 0)
|
||||||
|
|
||||||
|
if e.type == pygame.KEYUP:
|
||||||
|
|
||||||
|
if e.key == pygame.K_f:
|
||||||
|
self.actions["weapon swap"] = False
|
||||||
|
|
||||||
|
if e.type == pygame.MOUSEBUTTONUP:
|
||||||
|
|
||||||
|
if e.button == 1:
|
||||||
|
self.actions["attack"] = False
|
||||||
|
|
||||||
|
if e.button == 3:
|
||||||
|
self.actions["pattack"] = False
|
||||||
|
|
BIN
imgs/enemy/Bat.png
Normal file
After Width: | Height: | Size: 32 KiB |
BIN
imgs/enemy/Reaper.png
Normal file
After Width: | Height: | Size: 8.6 KiB |
BIN
imgs/enemy/Skeleton Archer.png
Normal file
After Width: | Height: | Size: 150 KiB |
BIN
imgs/enemy/bomb.png
Normal file
After Width: | Height: | Size: 44 KiB |
5075
imgs/enemy/boulder.ai
Normal file
BIN
imgs/enemy/boulder.png
Normal file
After Width: | Height: | Size: 42 KiB |
BIN
imgs/enemy/finalboss.png
Normal file
After Width: | Height: | Size: 239 KiB |
BIN
imgs/enemy/ghost.png
Normal file
After Width: | Height: | Size: 45 KiB |
BIN
imgs/enemy/glitch.png
Normal file
After Width: | Height: | Size: 173 KiB |
BIN
imgs/enemy/shadow.png
Normal file
After Width: | Height: | Size: 146 KiB |
BIN
imgs/enemy/slime.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
imgs/enemy/slime00cas.png
Normal file
After Width: | Height: | Size: 18 KiB |
BIN
imgs/enemy/slime00des.png
Normal file
After Width: | Height: | Size: 19 KiB |
59
imgs/enemy/spriteSimulator.py
Normal file
@ -0,0 +1,59 @@
|
|||||||
|
import pygame
|
||||||
|
|
||||||
|
#Reaper
|
||||||
|
##width = 64
|
||||||
|
##height = 64
|
||||||
|
##rows = 9
|
||||||
|
##columns = 5 #(number of frames)
|
||||||
|
##imagename = "Reaper.png"
|
||||||
|
|
||||||
|
#Bat
|
||||||
|
##width = 1047 / 4
|
||||||
|
##height = 1059 /4
|
||||||
|
##rows = 4
|
||||||
|
##columns = 3
|
||||||
|
##imagename = "bat.png"
|
||||||
|
|
||||||
|
#Boulder
|
||||||
|
##width = 96
|
||||||
|
##height = 96
|
||||||
|
##rows = 4
|
||||||
|
##columns = 3
|
||||||
|
##imagename = "boulder.png"
|
||||||
|
|
||||||
|
#bomb
|
||||||
|
width= 64
|
||||||
|
height = 64
|
||||||
|
rows = 4
|
||||||
|
columns = 4
|
||||||
|
imagename = "ghost 3.png"
|
||||||
|
|
||||||
|
pygame.display.init()
|
||||||
|
screen = pygame.display.set_mode((int(width),int(height*rows)))
|
||||||
|
clock = pygame.time.Clock()
|
||||||
|
done = False
|
||||||
|
|
||||||
|
img = pygame.image.load(imagename)
|
||||||
|
timeroriginal = .15
|
||||||
|
timer = timeroriginal
|
||||||
|
increment = 0
|
||||||
|
|
||||||
|
while not done:
|
||||||
|
screen.fill((0,0,0))
|
||||||
|
|
||||||
|
dT = clock.tick() / 1000.0
|
||||||
|
timer -= dT
|
||||||
|
if timer <= 0:
|
||||||
|
increment += 1
|
||||||
|
if increment == columns:
|
||||||
|
increment = 0
|
||||||
|
timer = timeroriginal
|
||||||
|
|
||||||
|
pygame.event.pump()
|
||||||
|
if pygame.key.get_pressed()[pygame.K_ESCAPE]:
|
||||||
|
done = True
|
||||||
|
|
||||||
|
screen.blit(img, (0 - ((width)*increment),0))
|
||||||
|
|
||||||
|
pygame.display.flip()
|
||||||
|
pygame.display.quit()
|
BIN
imgs/enemy/temp_slime.png
Normal file
After Width: | Height: | Size: 300 B |
BIN
imgs/floor/cas_floor.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
imgs/floor/cas_lava.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
imgs/floor/cas_pit.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
imgs/floor/cas_pitt.png
Normal file
After Width: | Height: | Size: 1.4 KiB |
BIN
imgs/floor/cas_spikes.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
imgs/floor/des_floor.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
imgs/floor/des_lava.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
imgs/floor/des_pit.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
imgs/floor/des_pitt.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/floor/des_spikes.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/floor/for_floor.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/floor/for_lava.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
imgs/floor/for_pit.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
imgs/floor/for_pitt.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/floor/for_spikes.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/floor/ice_floor.png
Normal file
After Width: | Height: | Size: 3.2 KiB |
BIN
imgs/floor/ice_lava.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
imgs/floor/ice_pit.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
imgs/floor/ice_pitt.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
imgs/floor/ice_spikes.png
Normal file
After Width: | Height: | Size: 625 B |
BIN
imgs/floor/lav_floor.png
Normal file
After Width: | Height: | Size: 782 B |
BIN
imgs/floor/lav_lava.png
Normal file
After Width: | Height: | Size: 2.9 KiB |
BIN
imgs/floor/lav_pit.png
Normal file
After Width: | Height: | Size: 122 B |
BIN
imgs/floor/lav_pitt.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
imgs/floor/lav_spikes.png
Normal file
After Width: | Height: | Size: 969 B |
BIN
imgs/gui/Background.png
Normal file
After Width: | Height: | Size: 201 KiB |
BIN
imgs/gui/Main Menu/Back_Black.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Back_Red.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Buttons.png
Normal file
After Width: | Height: | Size: 134 KiB |
BIN
imgs/gui/Main Menu/Credits_Black.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
imgs/gui/Main Menu/Credits_Red.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
imgs/gui/Main Menu/Inputs_Black.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Inputs_Red.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/MainMenu.png
Normal file
After Width: | Height: | Size: 65 KiB |
BIN
imgs/gui/Main Menu/NewGame_Black.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
imgs/gui/Main Menu/NewGame_Red.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
imgs/gui/Main Menu/Next_Black.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Next_Red.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Options_Black.png
Normal file
After Width: | Height: | Size: 40 KiB |
BIN
imgs/gui/Main Menu/Options_Red.png
Normal file
After Width: | Height: | Size: 39 KiB |
BIN
imgs/gui/Main Menu/SingleSword.png
Normal file
After Width: | Height: | Size: 977 B |
BIN
imgs/gui/Main Menu/Start_Black.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Start_Red.png
Normal file
After Width: | Height: | Size: 27 KiB |
BIN
imgs/gui/Main Menu/Thumbs.db
Normal file
BIN
imgs/gui/Main Menu/leftArrow_Black.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
imgs/gui/Main Menu/leftArrow_Red.png
Normal file
After Width: | Height: | Size: 258 B |
BIN
imgs/gui/Main Menu/newgame.png
Normal file
After Width: | Height: | Size: 73 KiB |
BIN
imgs/gui/Main Menu/options.png
Normal file
After Width: | Height: | Size: 67 KiB |
BIN
imgs/gui/Main Menu/rightArrow_Black.png
Normal file
After Width: | Height: | Size: 3.6 KiB |
BIN
imgs/gui/Main Menu/rightArrow_Red.png
Normal file
After Width: | Height: | Size: 268 B |
BIN
imgs/gui/Main Menu/staff.ai.png
Normal file
After Width: | Height: | Size: 180 KiB |
BIN
imgs/gui/Mouse and Keyboard.png
Normal file
After Width: | Height: | Size: 101 KiB |
BIN
imgs/gui/Xbox_Controller.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/gui/fourPlayer_Split.png
Normal file
After Width: | Height: | Size: 3.0 MiB |
BIN
imgs/gui/gameover1.png
Normal file
After Width: | Height: | Size: 37 KiB |
BIN
imgs/gui/gameover2.png
Normal file
After Width: | Height: | Size: 30 KiB |
BIN
imgs/gui/gameover4.png
Normal file
After Width: | Height: | Size: 28 KiB |
BIN
imgs/gui/titlescreen.png
Normal file
After Width: | Height: | Size: 236 KiB |
BIN
imgs/gui/twoPlayer_Split.png
Normal file
After Width: | Height: | Size: 3.0 MiB |
BIN
imgs/healthbar/Unarmed.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
imgs/healthbar/Unarmed4.png
Normal file
After Width: | Height: | Size: 4.5 KiB |
BIN
imgs/healthbar/archer.png
Normal file
After Width: | Height: | Size: 6.3 KiB |
BIN
imgs/healthbar/archer4.png
Normal file
After Width: | Height: | Size: 5.0 KiB |
BIN
imgs/healthbar/knight.png
Normal file
After Width: | Height: | Size: 7.6 KiB |
BIN
imgs/healthbar/knight4.png
Normal file
After Width: | Height: | Size: 7.0 KiB |
BIN
imgs/healthbar/mage.png
Normal file
After Width: | Height: | Size: 11 KiB |
BIN
imgs/healthbar/mage4.png
Normal file
After Width: | Height: | Size: 7.3 KiB |
BIN
imgs/notInUse/col.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
imgs/notInUse/f_floor.png
Normal file
After Width: | Height: | Size: 1.8 KiB |
BIN
imgs/notInUse/floor.png
Normal file
After Width: | Height: | Size: 2.3 KiB |
BIN
imgs/notInUse/floordesert.png
Normal file
After Width: | Height: | Size: 12 KiB |
After Width: | Height: | Size: 12 KiB |
BIN
imgs/notInUse/tree (fos wall possible replacement).png
Normal file
After Width: | Height: | Size: 12 KiB |
BIN
imgs/notInUse/wall.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
imgs/notInUse/xcas_wall.png
Normal file
After Width: | Height: | Size: 3.8 KiB |
BIN
imgs/notInUse/xcas_wallt.png
Normal file
After Width: | Height: | Size: 5.3 KiB |
BIN
imgs/notInUse/xdes_wall.png
Normal file
After Width: | Height: | Size: 1.2 KiB |
BIN
imgs/notInUse/xdes_wallt.png
Normal file
After Width: | Height: | Size: 2.7 KiB |