diff options
author | Aki <nthirtyone@gmail.com> | 2017-07-20 19:51:30 +0200 |
---|---|---|
committer | Aki <nthirtyone@gmail.com> | 2017-07-20 19:51:30 +0200 |
commit | 02aba07e03465205b45c41df7aec6894d4e89909 (patch) | |
tree | af81d678d770b0ef36a44d20f8dfed77c7161411 /not | |
parent | cc352d320bf87f2d9e4ca77497fb452958bab231 (diff) | |
download | roflnauts-02aba07e03465205b45c41df7aec6894d4e89909.zip roflnauts-02aba07e03465205b45c41df7aec6894d4e89909.tar.gz roflnauts-02aba07e03465205b45c41df7aec6894d4e89909.tar.bz2 |
Moved name-tag drawing to separate function; moved up overall in drawing functions
Diffstat (limited to 'not')
-rw-r--r-- | not/Hero.lua | 5 | ||||
-rw-r--r-- | not/World.lua | 4 |
2 files changed, 8 insertions, 1 deletions
diff --git a/not/Hero.lua b/not/Hero.lua index e8fa206..039aeb8 100644 --- a/not/Hero.lua +++ b/not/Hero.lua @@ -169,8 +169,11 @@ end function Hero:draw (offset_x, offset_y, scale, debug) if not self.isAlive then return end Hero.__super.draw(self, offset_x, offset_y, scale, debug) - love.graphics.setFont(Font) +end + +function Hero:drawTag (offset_x, offset_y, scale) local x,y = self:getPosition() + love.graphics.setFont(Font) love.graphics.printf(string.format("Player %d", math.abs(self.group)), (math.floor(x)+offset_x)*scale, (math.floor(y)+offset_y-26)*scale,100,'center',0,scale,scale,50,0) end diff --git a/not/World.lua b/not/World.lua index 86b1560..7317617 100644 --- a/not/World.lua +++ b/not/World.lua @@ -315,6 +315,10 @@ function World:draw () love.graphics.line(x1,y1,x2,y2) end + for _,naut in pairs(self.Nauts) do + naut:drawTag(offset_x, offset_y, scale) + end + -- Draw HUDs for _,naut in pairs(self.Nauts) do -- I have no idea where to place them T_T |