Compare commits

...

1 commit

Author SHA1 Message Date
Kazhnuz
d0d0b0d985 wip: rework battler 2020-06-05 10:02:04 +02:00
9 changed files with 70 additions and 0 deletions

View file

@ -8,6 +8,8 @@ function Battler:new(world, x, y, z)
self.speed = 3
self.isActive = false
self.debugActiveTimer = 0
self.side = ""
end
function Battler:destroy()

View file

@ -15,6 +15,7 @@ function Ennemy:new(world, x, y, id, number)
self.pp = self.data.stats.ppmax
self.shownHP = self.hp
self.side = "ennemy"
end
function Ennemy:draw()

View file

@ -25,6 +25,7 @@ function Hero:new(world, x, y, charid, charnumber)
self.statusbar = StatusBar(self)
self.side = "heroes"
self.doing = "nothing";
end
-- CHARACTER FUNCTIONS

View file

@ -0,0 +1,22 @@
local Player = Object:extend()
function Player:init()
self.activeActor = nil
self.currentScreen = ""
end
function Player:beginTurn(activeActor)
self.activeActor = activeActor
self.startx, self.starty = self.activeActor.x, self.activeActor.y
self.currentScreen = MoveScreen(self)
core.debug:print("cbs/hero", "hero " .. self.activeActor.charid .. " is now active")
self.characterData = game.characters.list[self.activeActor.charid]
self:initializeCursor()
end
function Player:initializeCursor()
end
return Player

View file

@ -0,0 +1,40 @@
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

View file

@ -1,11 +1,15 @@
local Scene = require "core.modules.scenes"
local OverWorld = Scene:extend()
local World = require "core.modules.world.world2D"
function OverWorld:new()
OverWorld.super.new(self)
World(self, actorlist, mapfile, maptype)
end
function OverWorld:update(dt)
end
function OverWorld:draw()