summaryrefslogtreecommitdiffhomepage
path: root/not/Hero.lua
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2017-09-22 18:02:42 +0200
committerAki <nthirtyone@gmail.com>2017-09-22 18:02:42 +0200
commit70cd74d62d0f6d1c389a3a3ef333acb578713727 (patch)
treedaee72e9c541b04152d404a36c0f00b59fa3c998 /not/Hero.lua
parent2235ec2648258bdf51c75280b2289cea0c970d0f (diff)
downloadroflnauts-70cd74d62d0f6d1c389a3a3ef333acb578713727.zip
roflnauts-70cd74d62d0f6d1c389a3a3ef333acb578713727.tar.gz
roflnauts-70cd74d62d0f6d1c389a3a3ef333acb578713727.tar.bz2
Hero now properly uses split-up portraits
Diffstat (limited to 'not/Hero.lua')
-rw-r--r--not/Hero.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/not/Hero.lua b/not/Hero.lua
index 2549b18..30092bc 100644
--- a/not/Hero.lua
+++ b/not/Hero.lua
@@ -21,6 +21,7 @@ Hero.PUNCH_UP = {-8,-4, -8,-20, 8,-20, 8,-4}
Hero.PUNCH_DOWN = {-8,4, -8,20, 8,20, 8,4}
-- TODO: Portrait managment in Hero and config passed from Menu should be reviewed!
+-- TODO: Clean-up, see `menus/select`.
function Hero:new (config, x, y, world)
local imagePath = config.image
Hero.load()
@@ -46,7 +47,8 @@ function Hero:new (config, x, y, world)
self.isJumping = false
self.spawntimer = 2
self.punchCooldown = 0
- self.portraitQuad = love.graphics.newQuad((config.portrait-1)*28, 0, 28, 27, 1176, 27)
+ -- TODO: Pass loaded portrait from menu to Hero.
+ self.portrait = love.graphics.newImage(config.portrait)
self:setAnimationsList(require("config.animations.hero"))
-- Post-creation
self:createEffect("respawn")
@@ -185,7 +187,7 @@ function Hero:drawHUD (x,y,scale,elevation)
if self.isAlive then
love.graphics.setColor(255,255,255,255)
love.graphics.draw(self.IMAGE_FRAME, self.QUAD_FRAME, (x)*scale, (y)*scale, 0, scale, scale)
- love.graphics.draw(self.IMAGE_PORTRAITS, self.portraitQuad, (x+2)*scale, (y+3)*scale, 0, scale, scale)
+ love.graphics.draw(self.portrait, (x+2)*scale, (y+3)*scale, 0, scale, scale)
local dy = 30 * elevation
love.graphics.setFont(Font)
love.graphics.print((self.combo).."%",(x+2)*scale,(y-3+dy)*scale,0,scale,scale)