/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous

« back to all changes in this revision

Viewing changes to rock.lua

  • Committer: Josh C
  • Date: 2013-05-14 00:15:01 UTC
  • Revision ID: josh@9ix.org-20130514001501-z14e702ncp21s0yr
try to not spawn rocks where you can see them.  not working if screen 
crosses game boundaries.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Rock = WrapTile:extend {
2
 
   image = 'data/rock.png'
 
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
3
25
}
 
 
b'\\ No newline at end of file'