Ejemplo n.º 1
0
    def __init__(self):
        self.cfg = ConfigHandler('thm.cfg')
        self.cfg.readConfig()
        self.groups = []
        self.floor = None
        self.space = pymunk.Space()
        self.space.gravity = (0.0, 0.0)
        self.space.damping = 0.0
        #self.space.set_default_collision_handler()
        self.space.add_collision_handler(1, 2, callSpeshulEffect)
        self.space.add_collision_handler(2, 2, callSpeshulEffect)
        self.speshulCaller = callSpeshulEffect
        self.postStepQueue = []

        self.gameLogicManager = ActualManager(self)
        self.justEditing = False

        self.spaceGhost = None

        #If this is true, devtools will class update EVERYTHING.
        self.forceUpdateEverything = False

        self.boundaryBody = pymunk.Body()
        self.boundaries = []

        #A list of int values that represent the index values of a
        #group in self.groups, each group is drawn in order of the
        # values in this list. Use addGroup() to add one, by default
        # it puts the group in the last index of self.drawOrder,
        # unless passed a index value.
        self.drawOrder = []
        self.interweaveOrder = {}

        self.curInputDict = {}

        self.playersGroup = None

        self.namedGroups = {'playersGroup': self.playersGroup}

        self.lineVisualiser = LineVisualiser(self)

        self.rerenderEverything = False

        self.soundManager = SoundManager(self)

        self.hudList = []

        self.fileName = "Untitled"
        self.amountOfEntsOnLoad = None

        self.hardBlockInput = False
        self.inputDictLog = []

        #These to variables are the displacement from the state's (0,0) and the screen's (0,0), so they can be used for panning.
        self.panX, self.panY = 0, 0
        self.limitX1, self.limitX2, self.limitY1, self.limitY2 = None, None, None, None

        #This is the idSource, I use it for give ids to Entitys.
        self.idSource = IdSource()

        self.isClient = False
        self.isHost = False
        self.networkRate = 20.0
        self.networkTicker = 0
        self.networkNode = None
        self.networkingStarted = False

        #This is set by the DevMenu init
        self.devMenuRef = None

        self.paused = False
        self.keyboardInputEnabled = False
        self.deleteLastChar = False
        self.checkFocus = False
        self.pausedByFocus = False

        #So this is quite an important boolean.
        #If this is true everything in the PlayState will be drawn in order of the bottom of it's bounding rect, which I will refer
        #to as 'the foot'. If the foot is higher up the screen, the item will be drawn sooner.
        #If this is False, everything will be drawn according to the drawOrder and interweaveOrder system.
        #DrawByFeet is more suitable for some topdown/isometric games.
        self.drawByFeet = False

        self.useSuggestedGravityEntityPhysics = False

        self.stateToSwap = None