/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:40:14 UTC
  • Revision ID: josh@9ix.org-20130513214014-cpvr4zqooyl6nxf3
don't fire from top-left corner of the ship.  ...  fire from center of 
ship for now.  :)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
DEBUG = true
3
3
 
4
4
require 'zoetrope'
 
5
--__ = require 'underscore'
 
6
vector = require 'vector'
 
7
 
 
8
require 'group'
5
9
 
6
10
require 'version'
 
11
require 'wrap_tile'
 
12
require 'player'
 
13
require 'enemy'
 
14
require 'cursor'
 
15
require 'bullet'
 
16
 
 
17
util = {
 
18
   signOf = function(value)
 
19
               if value >= 0 then
 
20
                  return 1
 
21
               else
 
22
                  return -1
 
23
               end
 
24
            end
 
25
}
7
26
 
8
27
GameView = View:extend {
9
28
   onNew = function (self)
10
 
              t = Text:new{y = 300, width = the.app.width, align = 'center',
11
 
                           text = 'This space intentionally left blank'}
12
 
              self:add(t)
 
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)
 
45
 
 
46
              --the.player = CrystalPlayer:new{x=400,y=300}
 
47
              the.player = SpacePlayer:new{x=1366,y=768}
 
48
              self:add(the.player)
 
49
 
 
50
              self:add(Enemy:new{x=400, y=300})
 
51
 
 
52
              the.cursor = Cursor:new()
 
53
              self:add(the.cursor)
 
54
 
 
55
              love.mouse.setGrab(true)
 
56
              love.mouse.setVisible(false)
13
57
 
14
58
              --self:loadLayers('data/map.lua')
15
 
              --self.focus = the.player
 
59
              self.focus = the.player
16
60
              --self:clampTo(self.map)
17
61
           end,
18
62
   draw = function (self, x, y)
42
86
              if DEBUG then
43
87
                 self.console:watch('VERSION', 'VERSION')
44
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')
45
93
                 --self.console:watch('drawTook', 'the.drawTook')
 
94
 
 
95
                 -- back off that dark overlay a bit
 
96
                 self.console.fill.fill[4] = 75
46
97
              end
47
98
           end,
48
99
   onUpdate = function (self, dt)