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
|
Rock = WrapTile:extend {
image = 'data/rock.png',
onNew = function(self)
--self.velocity = util.shortestVector(self, the.player):normalized() * 10
end,
onEndFrame = function(self, dt)
-- onEndFrame to give a chance to go out of bounds then wrap
if DEBUG and the.console.visible then
if not self.text then
self.text = Text:new()
the.view:add(self.text)
end
local pVec = util.shortestVector(self, the.player)
self.text.text = pVec.x .. ', ' .. pVec.y
self.text.x, self.text.y = self.x, self.y
self.text.visible = true
else
if self.text then
self.text.visible = false
end
end
end
}
|