From 70cd74d62d0f6d1c389a3a3ef333acb578713727 Mon Sep 17 00:00:00 2001 From: Aki Date: Fri, 22 Sep 2017 18:02:42 +0200 Subject: Hero now properly uses split-up portraits --- not/Hero.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'not') 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) -- cgit v1.1