40 lines
1.1 KiB
Lua
40 lines
1.1 KiB
Lua
local MoveSubController = Object:extend()
|
|
|
|
function MoveSubController:new(player)
|
|
self.player = player
|
|
self.actor = player.activeActor
|
|
self.characterData = game.characters.list[self.actor.charid]
|
|
end
|
|
|
|
function MoveSubController:initAction()
|
|
local x, y = utils.math.round(self.actor.x), utils.math.round(self.actor.y)
|
|
local gridSize = self:getGridSize()
|
|
|
|
self.world.cursor:setGrid(x, y, "circle", gridsize, 1, self)
|
|
self.world.cursor:set(self.startx, self.starty)
|
|
end
|
|
|
|
function MoveSubController:getGridSize()
|
|
local gridsize = self.characterData.move
|
|
if (gridsize == nil) then
|
|
gridsize = 3
|
|
core.debug:warning("cbs/move", "move value is nil")
|
|
end
|
|
return gridsize
|
|
end
|
|
|
|
function MoveSubController:receiveCursorSignal(x, y, cancel)
|
|
-- Comme ceci est la PREMIERE action du personnage, il n'y a pas de cancel
|
|
-- possible, puisque rien n'a été fait.
|
|
|
|
self.actor:changeAnimation("walk", true)
|
|
self.actor:goTo(x, y, 'cursorMove', 1)
|
|
self.actor.assets.sfx["woosh"]:play()
|
|
self.actor:blockTurnSystem()
|
|
end
|
|
|
|
function MoveSubController:moveComplete()
|
|
|
|
end
|
|
|
|
return MoveSubController
|