/traderous

To get this branch, use:
bzr branch http://9ix.org/bzr/traderous
3 by Josh C
basecode main.lua
1
STRICT = true
2
DEBUG = true
3
4
require 'zoetrope'
4 by Josh C
trying some movement styles. derivatives on crystal quest movement.
5
--__ = require 'underscore'
3 by Josh C
basecode main.lua
6
7
require 'version'
4 by Josh C
trying some movement styles. derivatives on crystal quest movement.
8
require 'player'
3 by Josh C
basecode main.lua
9
10
GameView = View:extend {
11
   onNew = function (self)
4 by Josh C
trying some movement styles. derivatives on crystal quest movement.
12
              for x = 1,30 do
13
                 for y = 1,30 do
14
                    self:add(Fill:new{x=x*400, y=y*400,
15
                                      width = 32, height = 32,
16
                                      fill = {0,0,255}
17
                                   })
18
                 end
19
              end
20
21
              --the.player = CrystalPlayer:new{x=400,y=300}
22
              the.player = SpacePlayer:new{x=400,y=300}
23
              self:add(the.player)
24
25
              love.mouse.setGrab(true)
26
              --love.mouse.setVisible(false)
3 by Josh C
basecode main.lua
27
28
              --self:loadLayers('data/map.lua')
4 by Josh C
trying some movement styles. derivatives on crystal quest movement.
29
              self.focus = the.player
3 by Josh C
basecode main.lua
30
              --self:clampTo(self.map)
31
           end,
32
   draw = function (self, x, y)
33
             View.draw(self, x, y)
34
             love.graphics.print('FPS:' .. love.timer.getFPS(), 20, 20)
35
          end
36
}
37
38
MenuScreen = View:extend {
39
   title = Text:new{text = "Press a key to start", font = 48, wordWrap = false},
40
   --title = Tile:new{image = 'data/title.png', x = 0, y = 0},
41
   onNew = function(self)
42
              self:add(self.title)
43
              self.title:centerAround(400, 200)
44
           end,
45
   onUpdate = function(self, elapsed)
46
                 if the.keys:allJustPressed() then
47
                    the.app.view = GameView:new()
48
                 end
49
              end
50
}
51
52
the.app = App:new {
53
   onRun = function (self)
54
              print('Version: ' .. VERSION)
55
              self.view = GameView:new()
56
              if DEBUG then
57
                 self.console:watch('VERSION', 'VERSION')
58
                 self.console:watch('updateTook', 'the.updateTook')
59
                 --self.console:watch('drawTook', 'the.drawTook')
60
              end
61
           end,
62
   onUpdate = function (self, dt)
63
                 if the.keys:justPressed('escape') then
64
                    self.quit()
65
                 end
66
              end,
67
   update = function (self, dt)
68
               the.updateStart = love.timer.getMicroTime()
69
               App.update(self, dt)
70
               if the.updateStart then
71
                  the.updateTook = love.timer.getMicroTime() - the.updateStart
72
               end
73
            end
74
}