/traderous

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-05-13 21:31:23 UTC
  • Revision ID: josh@9ix.org-20130513213123-n21tkmyb2u7xcjtz
monkey patch group to add onRemove hook.  remove mirrors on remove.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
require 'zoetrope'
5
5
--__ = require 'underscore'
 
6
vector = require 'vector'
 
7
 
 
8
require 'group'
6
9
 
7
10
require 'version'
 
11
require 'wrap_tile'
8
12
require 'player'
9
13
require 'enemy'
10
14
require 'cursor'
 
15
require 'bullet'
11
16
 
12
17
util = {
13
18
   signOf = function(value)
21
26
 
22
27
GameView = View:extend {
23
28
   onNew = function (self)
24
 
              for x = 1,30 do
25
 
                 for y = 1,30 do
26
 
                    self:add(Fill:new{x=x*400, y=y*400,
27
 
                                      width = 32, height = 32,
28
 
                                      fill = {0,0,255}
29
 
                                   })
30
 
                 end
31
 
              end
 
29
              -- for x = 1,30 do
 
30
              --    for y = 1,30 do
 
31
              --       self:add(Fill:new{x=x*400, y=y*400,
 
32
              --                         width = 32, height = 32,
 
33
              --                         fill = {0,0,255}
 
34
              --                      })
 
35
              --    end
 
36
              -- end
 
37
 
 
38
              the.bg = Tile:new{
 
39
                 image = 'data/stars3.png',
 
40
                 -- 1366x768 * 3
 
41
                 width = 4098,
 
42
                 height = 2304
 
43
              }
 
44
              self:add(the.bg)
32
45
 
33
46
              --the.player = CrystalPlayer:new{x=400,y=300}
34
 
              the.player = SpacePlayer:new{x=400,y=300}
 
47
              the.player = SpacePlayer:new{x=1366,y=768}
35
48
              self:add(the.player)
36
49
 
37
50
              self:add(Enemy:new{x=400, y=300})
38
51
 
39
 
              self:add(Cursor:new())
 
52
              the.cursor = Cursor:new()
 
53
              self:add(the.cursor)
40
54
 
41
55
              love.mouse.setGrab(true)
42
56
              love.mouse.setVisible(false)
72
86
              if DEBUG then
73
87
                 self.console:watch('VERSION', 'VERSION')
74
88
                 self.console:watch('updateTook', 'the.updateTook')
 
89
                 self.console:watch('the.player.x', 'the.player.x')
 
90
                 self.console:watch('the.player.y', 'the.player.y')
 
91
                 self.console:watch('the.app.width', 'the.app.width')
 
92
                 self.console:watch('the.app.height', 'the.app.height')
75
93
                 --self.console:watch('drawTook', 'the.drawTook')
 
94
 
 
95
                 -- back off that dark overlay a bit
 
96
                 self.console.fill.fill[4] = 75
76
97
              end
77
98
           end,
78
99
   onUpdate = function (self, dt)