bzr branch
http://9ix.org/bzr/traderous
26
by Josh C
rocks! |
1 |
Rock = WrapTile:extend { |
27
by Josh C
try to not spawn rocks where you can see them. not working if screen |
2 |
image = 'data/rock.png', |
3 |
onNew = function(self) |
|
4 |
--self.velocity = util.shortestVector(self, the.player):normalized() * 10 |
|
5 |
end, |
|
6 |
onEndFrame = function(self, dt) |
|
7 |
-- onEndFrame to give a chance to go out of bounds then wrap |
|
8 |
||
9 |
if DEBUG and the.console.visible then |
|
10 |
if not self.text then |
|
11 |
self.text = Text:new() |
|
12 |
the.view:add(self.text) |
|
13 |
end |
|
14 |
||
15 |
local pVec = util.shortestVector(self, the.player) |
|
16 |
self.text.text = pVec.x .. ', ' .. pVec.y |
|
17 |
self.text.x, self.text.y = self.x, self.y |
|
18 |
self.text.visible = true |
|
19 |
else |
|
20 |
if self.text then |
|
21 |
self.text.visible = false |
|
22 |
end |
|
23 |
end |
|
24 |
end |
|
26
by Josh C
rocks! |
25 |
} |