-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhumaninfo.lua
executable file
·59 lines (48 loc) · 1.63 KB
/
humaninfo.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
local class = require "middleclass.middleclass"
local Drawable = require "drawable"
local HumanInfo = class("HumanInfo", Drawable)
local global = require "global"
function HumanInfo:initialize(x, y) -- Unlikely to be used
Drawable.initialize(self, x, y)
self.selected = nil
end
function HumanInfo:update(dt)
local selcount = 0
for _, e in pairs(global.humans) do
if e.selected then
self.selected = e
selcount = selcount + 1
end
end
if selcount ~= 1 then
self.selected = nil
end
end
function HumanInfo:draw()
if self.selected then
local w = 200
local wL = 275
local x = love.graphics.getWidth() - w - 5
local xL = love.graphics.getWidth() - wL - 5
local y = 5
love.graphics.setColor(0, 0, 0)
love.graphics.printf(self.selected.name .. " (" .. math.floor(self.selected.hp) .. ")", x, y, w, "center")
y = y + 15
love.graphics.setColor(100, 100, 100)
love.graphics.printf("Mode: " .. self.selected.mode, xL, y, wL, "center")
y = y + 15
if self.selected.talent ~= nil then
love.graphics.setColor(100, 100, 100)
love.graphics.printf("[" .. self.selected.talent .. "]", x, y, w, "center")
end
y = y + 15
love.graphics.setColor(70, 130, 180)
love.graphics.printf(self.selected.dream, xL, y, wL, "right")
y = y + 30
if self.selected.lastsaid ~= nil then
love.graphics.setColor(165, 42, 42)
love.graphics.printf(self.selected.lastsaid, xL, y, wL, "right")
end
end
end
return HumanInfo