-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtp_levelMaker.py
37 lines (32 loc) · 1.52 KB
/
tp_levelMaker.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# levelMaker.py
# this includes all the music, terrains for each level
import copy, io
import pygame, pygame.midi
from tp_miscellaneous import *
from tp_missions import *
class MissionSetup(Missions):
def __init__(self, size, display, pathname):
self.width, self.height = size
self.display = display
self.pathname = "game_info/level_info/" + pathname
# this should set up all the levels
self.initLevels() # music and player
self.setupLevels(self.pathname, self.display, self.colorDict)
self.tonic = Missions.getTonic(self.pathname + "/init.txt")[0]
self.bpm = Missions.getBPM(self.pathname + "/init.txt")[0]
self.timeInterval = Missions.getTimeInterval(self.bpm)
def initLevels(self):
# set up the music dictionary
self.music = Missions.setupMusicDict(self.pathname + "/init.txt")
# this is so we can return the initial status bytes
self.music["init"] = set()
for (status, data1) in Missions.initiateMusic(self.pathname + "/init.txt"):
self.music["init"].add((status, data1))
# set up color templates
self.colorDict = Missions.initiateLevel(self.pathname + "/init.txt")[0]
def setupPlayer(self):
# set up player and player.mask
self.player = Player((self.width // 5, self.height // 3 * 2),
self.colorDict["player"], self)
self.player.mask, self.player.axis = Missions.initiatePlayer(self.player, self.display)
return self.player