-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhuman.lua
36 lines (32 loc) · 1.19 KB
/
human.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
Human = {}
Human.__index = Human
function Human:create(gender, type)
local human = {}
setmetatable(human, Human)
local all_genders = {"male", "female"}
local all_types = {"business", "tourist", "pupil"}
human.gender = gender or all_genders[math.random(2)]
human.type = type or all_types[math.random(3)]
human.graphics = g_wagon
if human.gender == "male" and human.type == "business" then
human.graphics = g_busim
elseif human.gender == "male" and human.type == "tourist" then
human.graphics = g_vacam
elseif human.gender == "male" and human.type == "pupil" then
human.graphics = g_schom
elseif human.gender == "female" and human.type == "business" then
human.graphics = g_busiw
elseif human.gender == "female" and human.type == "tourist" then
human.graphics = g_vacaw
elseif human.gender == "female" and human.type == "pupil" then
human.graphics = g_schow
end
return human
end
function Human:draw(x, y, linepos, turn)
if turn == 0 then
love.graphics.draw(self.graphics, x, y + linepos * 25, 0, -1, 1)
else
love.graphics.draw(self.graphics, x, y + linepos * 25, 0, 1, 1)
end
end