/traderous

To get this branch, use:
bzr branch /bzr/traderous

« back to all changes in this revision

Viewing changes to bullet.lua

  • Committer: Josh C
  • Date: 2013-05-13 20:41:14 UTC
  • Revision ID: josh@9ix.org-20130513204114-wtg735gs4b38wad4
extract wrapping behavior, wrap bullets

Show diffs side-by-side

added added

removed removed

1
1
-- TODO: these need to come out of a factory
2
2
 
3
 
Bullet = Tile:extend {
 
3
Bullet = WrapTile:extend {
4
4
   image = 'data/laser.png',
5
5
   onNew = function(self)
6
6
              --self.velocity = vector.new(1000, 0) -- veclocity 800
18
18
              self.createdAt = love.timer.getTime()
19
19
           end,
20
20
   onUpdate = function(self, dt)
21
 
                 if love.timer.getTime() - self.createdAt > 2 then
 
21
                 if love.timer.getTime() - self.createdAt > 1 then
22
22
                    -- TODO: reuse these (see factory idea above)
23
23
                    self:die()
24
24
                    the.app.view:remove(self)