summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorAki <nthirtyone@gmail.com>2016-05-21 20:35:47 +0200
committerAki <nthirtyone@gmail.com>2016-05-21 20:35:47 +0200
commit482797c1feab2b238822202593c1964c648d4198 (patch)
tree0fbbeb1301ad8422090858ffc49abea7142c2f07
parent4b63616195fd1910b7aa5d46b6489c9bdd054fa1 (diff)
downloadroflnauts-482797c1feab2b238822202593c1964c648d4198.zip
roflnauts-482797c1feab2b238822202593c1964c648d4198.tar.gz
roflnauts-482797c1feab2b238822202593c1964c648d4198.tar.bz2
HUD combo/lives
-rw-r--r--assets/font2.pngbin0 -> 3456 bytes
-rw-r--r--main.lua7
-rw-r--r--player.lua7
-rw-r--r--world.lua7
4 files changed, 15 insertions, 6 deletions
diff --git a/assets/font2.png b/assets/font2.png
new file mode 100644
index 0000000..ea6a58e
--- /dev/null
+++ b/assets/font2.png
Binary files differ
diff --git a/main.lua b/main.lua
index 5febe09..8d9a9df 100644
--- a/main.lua
+++ b/main.lua
@@ -10,7 +10,7 @@ require "effect"
-- Temporary debug
debug = false
-third = false
+third = true
fourth = false
-- Load
@@ -19,6 +19,11 @@ function love.load ()
love.graphics.setBackgroundColor(189, 95, 93)
love.graphics.setDefaultFilter("nearest", "nearest")
+ -- Font
+ Font = love.graphics.newImageFont("assets/font2.png", " 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz.-,!:()[]{}<>", -1)
+ Font:setLineHeight(1)
+ love.graphics.setFont(Font)
+
-- ZU WARUDO!
w = World:new()
w:createPlatform(290/2, 180/2, {-91,1, 90,1, 90,10, 5,76, -5,76, -91,10}, "assets/platform_big.png")
diff --git a/player.lua b/player.lua
index bb30f21..abaf37d 100644
--- a/player.lua
+++ b/player.lua
@@ -271,8 +271,13 @@ function Player:draw (offset_x, offset_y, scale, debug)
end
-- Draw HUD of `Player`
-function Player:drawHUD (x,y,scale)
+-- elevation: 1 bottom, 0 top
+function Player:drawHUD (x,y,scale,elevation)
+ love.graphics.setColor(255,255,255,255)
love.graphics.draw(self.portrait_sprite, self.portrait_sheet[self.name].normal, x*scale, y*scale, 0, scale, scale)
+ local dy = 30 * elevation
+ love.graphics.print(self.combo.."0x",(x+2)*scale,(y-3+dy)*scale,0,scale,scale)
+ love.graphics.print(math.max(0, self.lives),(x+24)*scale,(y-3+dy)*scale,0,scale,scale)
end
-- Change animation of `Player`
diff --git a/world.lua b/world.lua
index 56b67be..d896f18 100644
--- a/world.lua
+++ b/world.lua
@@ -173,10 +173,9 @@ function World:draw()
for _,naut in pairs(self.Nauts) do
-- I have no idea where to place them T_T
-- let's do: bottom-left, bottom-right, top-left, top-right
- -- equation that gives 0 with 1,2 and 1 with 3,4 -- fffs lets make statement
- local y = 1
- if _ < 3 then y = 180-33 end
- naut:drawHUD(1+(_%2)*(290-34), y, scale)
+ local y, e = 1, 1
+ if _ < 3 then y, e = 180-33, 0 end
+ naut:drawHUD(1+(_%2)*(290-34), y, scale, e)
end
end