/spacey

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

« 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:
2
2
   image = 'data/rock.png',
3
3
   onNew = function(self)
4
4
              --self.velocity = util.shortestVector(self, the.player):normalized() * 10
5
 
 
6
 
              --self.scale = 1
7
 
 
8
 
              self.collider = Fill:new{
9
 
                 fill = {0,0,255},
10
 
                 --x = self.x,
11
 
                 --y = self.y,
12
 
                 width = self.width * self.scale,
13
 
                 height = self.height * self.scale,
14
 
                 visible = false,
15
 
                 rock = self
16
 
              }
17
 
 
18
 
              the.app.view:add(self.collider)
19
 
              table.insert(the.rockColliders, self.collider)
20
5
           end,
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 -- ???
25
 
              end,
26
 
   onEndFrame = function(self)
 
6
   onEndFrame = function(self, dt)
27
7
                   -- onEndFrame to give a chance to go out of bounds then wrap
28
8
 
29
9
                   if DEBUG and the.console.visible then
31
11
                         self.text = Text:new()
32
12
                         the.view:add(self.text)
33
13
                      end
34
 
 
 
14
                      
35
15
                      local pVec = util.shortestVector(self, the.player)
36
16
                      self.text.text = pVec.x .. ', ' .. pVec.y
37
17
                      self.text.x, self.text.y = self.x, self.y
42
22
                      end
43
23
                   end
44
24
                end
45
 
}
 
25
}
 
 
b'\\ No newline at end of file'