parent
693150029c
commit
4bb4c14198
4 changed files with 16 additions and 2 deletions
|
@ -14,4 +14,6 @@ return {
|
|||
canBreakCraft = false,
|
||||
|
||||
icon = 3,
|
||||
charset = "perso",
|
||||
charId = 3,
|
||||
}
|
||||
|
|
|
@ -14,4 +14,6 @@ return {
|
|||
canBreakCraft = false,
|
||||
|
||||
icon = 2,
|
||||
charset = "perso",
|
||||
charId = 2,
|
||||
}
|
||||
|
|
|
@ -143,6 +143,10 @@ function CharacterManager:getActiveCharacter()
|
|||
return self.team[self.active]
|
||||
end
|
||||
|
||||
function CharacterManager:getActiveCharacterData()
|
||||
return self.list[self.team[self.active]]
|
||||
end
|
||||
|
||||
-- DEBUG FUNCTIONS
|
||||
|
||||
function CharacterManager:printCharacter(id)
|
||||
|
|
|
@ -5,6 +5,7 @@ local Player = Parent:extend()
|
|||
function Player:new(world, x, y, id)
|
||||
Player.super.new(self, world, "player", x, y, 16, 16, true)
|
||||
self.charset:addTexture("perso")
|
||||
self.active = game.characters:getActiveCharacterData()
|
||||
end
|
||||
|
||||
function Player:isMoving()
|
||||
|
@ -30,13 +31,18 @@ function Player:updateStart(dt)
|
|||
self.xsp = 120
|
||||
self.charDir = "right"
|
||||
end
|
||||
|
||||
if self.keys["select"].isPressed then
|
||||
game.characters:setActiveCharacter()
|
||||
self.active = game.characters:getActiveCharacterData()
|
||||
end
|
||||
end
|
||||
|
||||
function Player:draw()
|
||||
if (self:isMoving()) then
|
||||
self.charset:draw("perso", 1, self.charDir, self.x, self.y)
|
||||
self.charset:draw(self.active.data.charset, self.active.data.charId, self.charDir, self.x, self.y)
|
||||
else
|
||||
self.charset:drawStanding("perso", 1, self.charDir, self.x, self.y)
|
||||
self.charset:drawStanding(self.active.data.charset, self.active.data.charId, self.charDir, self.x, self.y)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue