-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtile.lua
More file actions
executable file
·40 lines (38 loc) · 1.28 KB
/
tile.lua
File metadata and controls
executable file
·40 lines (38 loc) · 1.28 KB
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
Tile = {}
-- Constructor
function Tile:new(xpos, ypos, type)
local object = {
x = xpos,
y = ypos,
tileType = type,
color = nil,
isCharOn = false,
isVillainOn = false,
isDangerTile = false,
isWarfoged = true,
moving = false,
destination = nil,
imageWarfoged = love.graphics.newImage('img/board/warfoged.png'),
imageBlank = love.graphics.newImage('img/board/blank.png'),
imageBlock = love.graphics.newImage('img/board/block.png'),
imageBlue = love.graphics.newImage('img/board/blue.png'),
imageRed = love.graphics.newImage('img/board/red.png'),
}
setmetatable(object, { __index = Tile })
return object
end
function Tile:draw()
if self.tileType == "blankTile" then
draw_on_tile(self.imageBlank, (self.x), (self.y))
elseif self.tileType == "blockTile" then
draw_on_tile(self.imageBlock, (self.x), (self.y))
end
if self.color == 'blue' then
draw_on_tile(self.imageBlue, (self.x), (self.y))
elseif self.color == 'red' then
draw_on_tile(self.imageRed, (self.x), (self.y))
end
--if self.isWarfoged then
-- draw_on_tile(self.imageWarfoged, (self.x), (self.y))
--end
end