-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBox.lua
More file actions
17 lines (16 loc) · 712 Bytes
/
Copy pathBox.lua
File metadata and controls
17 lines (16 loc) · 712 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
Box = Class{}
function Box:init(follow, xOffset, yOffset, class)
self.follow = follow
self.w = self.follow.w
self.h = self.follow.h
self.xOffset = xOffset
self.yOffset = yOffset
self.box = world:newRectangleCollider(self.follow.x + self.xOffset, self.follow.y + self.yOffset, self.w, self.h)
self.box:setCollisionClass(class)
self.box:setObject(self)
end
function Box:update(dt)
--[[self.box:destroy()
self.box = world:newRectangleCollider(math.floor(self.follow.x + self.xOffset), math.floor(self.follow.y + self.yOffset), self.w, self.h)--]]
self.box:setPosition(math.floor(self.follow.x + self.xOffset), math.floor(self.follow.y + self.yOffset))
end