1
1
Rock = WrapTile:extend {
2
image = 'data/rock.png'
b'\\ No newline at end of file'
2
image = 'data/rock.png',
4
--self.velocity = util.shortestVector(self, the.player):normalized() * 10
8
self.collider = Fill:new{
12
width = self.width * self.scale,
13
height = self.height * self.scale,
18
the.app.view:add(self.collider)
19
table.insert(the.rockColliders, self.collider)
21
onUpdate = function(self, dt)
22
self.collider.x = self.x + self.width / 2 * (1 - self.scale)
23
self.collider.y = self.y + self.height / 2 * (1 - self.scale)
24
--self.collider.rotation = self.rotation -- ???
26
onEndFrame = function(self)
27
-- onEndFrame to give a chance to go out of bounds then wrap
29
if DEBUG and the.console.visible then
31
self.text = Text:new()
32
the.view:add(self.text)
35
local pVec = util.shortestVector(self, the.player)
36
self.text.text = pVec.x .. ', ' .. pVec.y
37
self.text.x, self.text.y = self.x, self.y
38
self.text.visible = true
41
self.text.visible = false