Ajout des derniers développement #1
1 changed files with 0 additions and 60 deletions
|
@ -1,8 +1,6 @@
|
|||
local Battler = require("scenes.battlesystem.actors.battler")
|
||||
local Hero = Battler:extend()
|
||||
|
||||
local gui = require "game.modules.gui"
|
||||
|
||||
local ChoregraphySystem = require "scenes.battlesystem.actors.systems.choregraphy"
|
||||
|
||||
-- INIT FUNCTIONS
|
||||
|
@ -15,67 +13,25 @@ function Hero:new(world, x, y, owner, charnumber)
|
|||
|
||||
self:initMovementSystem()
|
||||
|
||||
--self:initCharacter(charid)
|
||||
|
||||
self:initSprite()
|
||||
self:initChoregraphySystem()
|
||||
|
||||
self.side = "heroes"
|
||||
end
|
||||
|
||||
-- CHARACTER FUNCTIONS
|
||||
-- All functions related to character handling
|
||||
|
||||
function Hero:initCharacter(charid)
|
||||
if charid == nil then
|
||||
core.debug:error("FATAL ERROR: charid not set")
|
||||
end
|
||||
self.owner.name = charid
|
||||
|
||||
self.turnAction = nil
|
||||
end
|
||||
|
||||
-- ACTIVITY FUNCTION
|
||||
-- Function to set or unset activity to the character
|
||||
|
||||
function Hero:setActive()
|
||||
core.debug:print("cbs/hero", "hero " .. self.owner.name .. " is now active")
|
||||
local gridsize = game.characters.list[self.owner.name].move
|
||||
if (gridsize == nil) then
|
||||
gridsize = 3
|
||||
core.debug:warning("cbs/character", "move value is nil")
|
||||
end
|
||||
self.world.cursor:setGrid(self.x, self.y, "circle", gridsize, 1, self)
|
||||
self.x, self.y = utils.math.round(self.x), utils.math.round(self.y)
|
||||
self.startx, self.starty = self.x, self.y
|
||||
|
||||
self.world.cursor:set(self.startx, self.starty, "cursorMove")
|
||||
|
||||
self.directionPrevious = self.direction
|
||||
end
|
||||
|
||||
-- UPDATE FUNCTION
|
||||
-- Update the hero
|
||||
|
||||
function Hero:update(dt)
|
||||
Hero.super.update(self, dt)
|
||||
-- Get keys to have some keyboard functions
|
||||
self.keys = self.scene:getKeys(1)
|
||||
|
||||
-- Calculate speed to calculate animation speed
|
||||
self:updateSpeed(dt)
|
||||
|
||||
self:updateChoregraphy(dt)
|
||||
|
||||
if (self.scene:haveMenus()) then
|
||||
self:changeDirection(dt)
|
||||
end
|
||||
|
||||
self.xprevious = self.x
|
||||
self.yprevious = self.y
|
||||
self.zprevious = self.z
|
||||
|
||||
--self.statusbar:update(dt)
|
||||
end
|
||||
|
||||
-- MOVE FUNCTIONS
|
||||
|
@ -153,15 +109,6 @@ function Hero:updateSpeed(dt)
|
|||
self:setCustomSpeed(self.gspeed * 320)
|
||||
end
|
||||
|
||||
function Hero:changeDirection(dt)
|
||||
-- Change direction by pressing left or right when selecting the next action
|
||||
if (self.keys["left"].isPressed) then
|
||||
self.direction = -1
|
||||
elseif (self.keys["right"].isPressed) then
|
||||
self.direction = 1
|
||||
end
|
||||
end
|
||||
|
||||
function Hero:initJump()
|
||||
self.jump = {}
|
||||
self.jump.spin = false
|
||||
|
@ -315,13 +262,6 @@ function Hero:unblockChoregraphy()
|
|||
self.blockingChoregraphy = ""
|
||||
end
|
||||
|
||||
-- INFO FUNCTIONS
|
||||
-- Getting info about the actor
|
||||
|
||||
function Hero:getCharacterData()
|
||||
return game.characters.list[self.owner.name]
|
||||
end
|
||||
|
||||
-- ASSETS FUNCTIONS
|
||||
-- Load and play assets needed by the character
|
||||
|
||||
|
|
Loading…
Reference in a new issue