Ejemplo n.º 1
0
    def battle_init(self):
        self.subphase = None

        # Instanciate the camera handler
        self.camhandler = CameraHandler()

        # Instanciate the keyboard tile traverser
        self.inputs = KeyboardTileTraverser(self)

        # Instanciate the battle graphics
        self.battleGraphics = BattleGraphics(self.party['map'])

        # Light the scene
        self.battleGraphics.lightScene()

        # Display the terrain
        self.battleGraphics.displayTerrain()

        # Play the background music
        self.music = base.loader.loadSfx(GAME + '/music/' +
                                         self.party['map']['music'] + '.ogg')
        self.music.setLoop(True)
        self.music.play()

        # Load sounds
        self.hover_snd = base.loader.loadSfx(GAME + "/sounds/hover.ogg")
        self.clicked_snd = base.loader.loadSfx(GAME + "/sounds/clicked.ogg")
        self.cancel_snd = base.loader.loadSfx(GAME + "/sounds/cancel.ogg")
        self.attack_snd = base.loader.loadSfx(GAME + "/sounds/attack.ogg")
        self.die_snd = base.loader.loadSfx(GAME + "/sounds/die.ogg")

        # Place highlightable tiles on the map
        self.matrix = Matrix(self.battleGraphics, self.party['map'])
        self.matrix.placeChars(self.party['chars'])

        # Instanciate and hide the AT flag
        self.at = AT()
        self.at.hide()

        self.charbars = None
        self.charcard = None
        self.actionpreview = None

        # Generate the sky and attach it to the camera
        self.sky = Sky(self.party['map'])

        # Tasks
        taskMgr.add(self.characterDirectionTask, 'characterDirectionTask')

        # Cursor stuff
        self.cursor = Cursor(self.battleGraphics, self.matrix.container)

        # Add the special effects
        self.battleGraphics.addEffects()

        # Battle intro animation
        SequenceBuilder.battleIntroduction(self).start()
Ejemplo n.º 2
0
	def battle_init(self):
		self.subphase = None
		
		# Instanciate the camera handler
		self.camhandler = CameraHandler()
		
		# Instanciate the keyboard tile traverser
		self.inputs = KeyboardTileTraverser(self)
		
		# Instanciate the battle graphics
		self.battleGraphics = BattleGraphics(self.party['map'])
		
		# Light the scene
		self.battleGraphics.lightScene()
		
		# Display the terrain
		self.battleGraphics.displayTerrain()
		
		# Play the background music
		self.music = base.loader.loadSfx(GAME+'/music/'+self.party['map']['music']+'.ogg')
		self.music.setLoop(True)
		self.music.play()
		
		# Load sounds
		self.hover_snd   = base.loader.loadSfx(GAME+"/sounds/hover.ogg")
		self.clicked_snd = base.loader.loadSfx(GAME+"/sounds/clicked.ogg")
		self.cancel_snd  = base.loader.loadSfx(GAME+"/sounds/cancel.ogg")
		self.attack_snd  = base.loader.loadSfx(GAME+"/sounds/attack.ogg")
		self.die_snd     = base.loader.loadSfx(GAME+"/sounds/die.ogg")
		
		# Place highlightable tiles on the map
		self.matrix = Matrix(self.battleGraphics, self.party['map'])
		self.matrix.placeChars(self.party['chars'])
		
		# Instanciate and hide the AT flag
		self.at = AT()
		self.at.hide()
		
		self.charbars = None
		self.charcard = None
		self.actionpreview = None
		
		# Generate the sky and attach it to the camera
		self.sky = Sky(self.party['map'])
		
		# Tasks
		taskMgr.add(self.characterDirectionTask , 'characterDirectionTask')
		
		# Cursor stuff
		self.cursor = Cursor(self.battleGraphics, self.matrix.container)
		
		# Add the special effects
		self.battleGraphics.addEffects()
		
		# Battle intro animation
		SequenceBuilder.battleIntroduction(self).start()
Ejemplo n.º 3
0
def execute(client, iterator):
    charid = iterator.getString()
    walkables = json.loads(iterator.getString())
    path = json.loads(iterator.getString())

    client.inputs.ignoreAll()
    (x1, y1, z1) = path[0]
    (x2, y2, z2) = path[-1]
    del client.party["map"]["tiles"][x1][y1][z1]["char"]
    client.party["map"]["tiles"][x2][y2][z2]["char"] = charid
    seq = Sequence()
    seq.append(Func(client.matrix.setupPassiveWalkableZone, walkables))
    seq.append(Wait(0.5))
    seq.append(Func(client.updateCursorPos, (x2, y2, z2)))
    seq.append(Wait(0.5))
    seq.append(Func(client.at.hide))
    seq.append(Func(client.updateSpriteAnimation, charid, "run"))
    seq.append(Func(client.camhandler.move, client.battleGraphics.logic2terrain((x2, y2, z2))))
    seq.append(SequenceBuilder.characterMoveSequence(client, charid, path))
    seq.append(Wait(0.5))
    seq.append(Func(client.updateSpriteAnimation, charid))
    seq.append(Func(client.matrix.clearZone))
    seq.append(Func(client.at.showOnSprite, client.matrix.sprites[charid]))
    seq.append(Func(client.send.UPDATE_PARTY))
    seq.start()
Ejemplo n.º 4
0
def execute(client, iterator):
    charid = iterator.getString()
    walkables = json.loads(iterator.getString())
    path = json.loads(iterator.getString())

    client.inputs.ignoreAll()
    (x1, y1, z1) = path[0]
    (x2, y2, z2) = path[-1]
    del client.party['map']['tiles'][x1][y1][z1]['char']
    client.party['map']['tiles'][x2][y2][z2]['char'] = charid
    seq = Sequence()
    seq.append(Func(client.matrix.setupPassiveWalkableZone, walkables))
    seq.append(Wait(0.5))
    seq.append(Func(client.updateCursorPos, (x2, y2, z2)))
    seq.append(Wait(0.5))
    seq.append(Func(client.at.hide))
    seq.append(Func(client.updateSpriteAnimation, charid, 'run'))
    seq.append(
        Func(client.camhandler.move,
             client.battleGraphics.logic2terrain((x2, y2, z2))))
    seq.append(SequenceBuilder.characterMoveSequence(client, charid, path))
    seq.append(Wait(0.5))
    seq.append(Func(client.updateSpriteAnimation, charid))
    seq.append(Func(client.matrix.clearZone))
    seq.append(Func(client.at.showOnSprite, client.matrix.sprites[charid]))
    seq.start()
Ejemplo n.º 5
0
def execute(client, iterator):
    charid = iterator.getString()
    targetid = iterator.getString()
    damages = iterator.getUint8()

    print(damages)
    target = client.party['chars'][targetid]
    target['hp'] = target['hp'] - damages
    if target['hp'] < 0:
        target['hp'] = 0

    seq = Sequence()
    seq.append( SequenceBuilder.characterAttackSequence(client, charid, targetid) )
    seq.append( Func(client.send.UPDATE_PARTY) )
    seq.start()
Ejemplo n.º 6
0
def execute(client, iterator):
    charid = iterator.getString()
    orig = json.loads(iterator.getString())
    origdir = iterator.getUint8()
    dest = json.loads(iterator.getString())
    path = json.loads(iterator.getString())

    seq = Sequence()
    seq.append(Func(client.at.hide))
    seq.append(Func(client.updateSpriteAnimation, charid, 'run'))
    seq.append(Func(client.matrix.clearZone))
    seq.append(SequenceBuilder.characterMoveSequence(client, charid, path))
    seq.append(Func(client.updateSpriteAnimation, charid))
    seq.append(Func(client.moveCheck, charid, orig, origdir, dest))
    seq.start()
Ejemplo n.º 7
0
def execute(client, iterator):
    charid = iterator.getString()
    orig = json.loads(iterator.getString())
    origdir = iterator.getUint8()
    dest = json.loads(iterator.getString())
    path = json.loads(iterator.getString())

    seq = Sequence()
    seq.append( Func(client.at.hide) )
    seq.append( Func(client.updateSpriteAnimation, charid, 'run') )
    seq.append( Func(client.matrix.clearZone) )
    seq.append( SequenceBuilder.characterMoveSequence(client, charid, path) )
    seq.append( Func(client.updateSpriteAnimation, charid) )
    seq.append( Func(client.moveCheck, charid, orig, origdir, dest) )
    seq.start()
Ejemplo n.º 8
0
def execute(client, iterator):
    charid = iterator.getString()
    targetid = iterator.getString()
    damages = iterator.getUint8()

    print damages
    target = client.party['chars'][targetid]
    target['hp'] = target['hp'] - damages
    if target['hp'] < 0:
        target['hp'] = 0

    seq = Sequence()
    seq.append(
        SequenceBuilder.characterAttackSequence(client, charid, targetid))
    seq.append(Func(client.send.UPDATE_PARTY))
    seq.start()
Ejemplo n.º 9
0
def execute(client, iterator):
    charid = iterator.getString()
    targetid = iterator.getString()
    damages = iterator.getUint8()
    attackables = json.loads(iterator.getString())

    print damages
    target = client.party['chars'][targetid]
    target['hp'] = target['hp'] - damages
    if target['hp'] < 0:
        target['hp'] = 0

    client.inputs.ignoreAll()
    seq = Sequence()
    seq.append( Func(client.matrix.setupAttackableZone, charid, attackables) )
    seq.append( Wait(0.5) )
    seq.append( Func(client.updateCursorPos, client.matrix.getCharacterCoords(targetid)) )
    seq.append( Func(client.camhandler.move, client.battleGraphics.logic2terrain(client.matrix.getCharacterCoords(targetid))) )
    seq.append( Wait(0.5) )
    seq.append( SequenceBuilder.characterAttackSequence(client, charid, targetid) )
    seq.append( Func(client.camhandler.move, client.battleGraphics.logic2terrain(client.matrix.getCharacterCoords(charid))) )
    seq.start()