-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathenvironment.lua
37 lines (32 loc) · 969 Bytes
/
environment.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
local MapSubject = {}
MapSubject.__index = MapSubject
local col_shadow = { 0, 0, 0, 100 }
local shadowOffsetX = 50
local shadowOffsetY = 50
local shadowSize = 1
function MapSubject:new(item, x, y)
local o = {}
setmetatable( o, MapSubject )
o.x = x
o.y = y
o.color = {255, 255, 255, 255}
--o.boundaryX
o.r = math.random(0, math.pi*2) -- rotation
o.body = images[item .. ".png"]
o.castshadow = true
o.shadow = images[item .. ".png"]
o.name = item
return o
end
function MapSubject:draw()
-- first draw shadow
if self.castshadow then
love.graphics.setColor(col_shadow)
love.graphics.draw(self.shadow, self.x+shadowOffsetX, self.y+shadowOffsetY, self.r, shadowSize, shadowSize, self.body:getWidth()/2, self.body:getHeight()/2, 0, 0)
end
love.graphics.setColor(self.color)
love.graphics.draw(self.body, self.x, self.y, self.r, 1, 1, self.body:getWidth()/2, self.body:getHeight()/2, 0, 0)
end
function MapSubject:update( dt )
end
return MapSubject