-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCrate.lua
More file actions
28 lines (24 loc) · 696 Bytes
/
Crate.lua
File metadata and controls
28 lines (24 loc) · 696 Bytes
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
-- Crate.lua
Crate = class(Panel)
function Crate:init(x,y,config,colStr,imgName,screen)
Panel.init(self,x,y)
self.config = config
self.imgName = imgName
self.colStr = colStr
assert(self.colStr ~= nil, "creating a crate without a colstr")
if not self.config.shadows then
self.obj = SpriteObj(0,0,config.w,config.h)
else
self.obj = ShadowObj(0,0,config.w,config.h)
end
self:addToScreen(screen)
self:add(self.obj)
end
function Crate:addToScreen(screen)
if not self.config.shadows then
screen:doDraw(self.obj,self.imgName)
else
screen:doDraw(self.obj,self.imgName,0,-8)
self.obj:setSizeOff(0,-1)
end
end