/zoeplat

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-04-10 23:47:59 UTC
  • Revision ID: josh@9ix.org-20130410234759-nrzne3xed1puy1v2
put sprite and player in their own files

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
require 'pepperprof'
8
8
require 'getopt_alt'
9
9
 
10
 
require 'sprite'
11
 
require 'animation'
12
 
require 'player'
13
 
require 'balloon'
14
 
 
15
10
util = {
16
11
   dim = function(dir)
17
12
      if dir == 'x' then
55
50
   --        end
56
51
}
57
52
 
58
 
MenuScreen = View:extend {
59
 
   --title = Text:new{text = "Test Platform Game", font = 48, wordWrap = false},
60
 
   title = Tile:new{image = 'data/title.png', x = 0, y = 0},
61
 
   onNew = function(self)
62
 
              self:add(self.title)
63
 
              --self.title:centerAround(400, 200)
64
 
           end,
65
 
   onUpdate = function(self, elapsed)
66
 
                 if the.keys:allJustPressed() then
67
 
                    the.app.view = GameView:new()
68
 
                 end
69
 
              end
70
 
}
71
 
 
72
53
the.app = App:new {
73
54
   record = true,
74
55
   onRun = function (self)
75
 
              self.view = MenuScreen:new()
76
 
              if DEBUG then
77
 
                 self.console:watch('onGround', 'the.player.onGround')
78
 
                 self.console:watch('onWall', 'the.player.onWall')
79
 
                 self.console:watch('updateTook', 'the.updateTook')
80
 
                 self.console:watch('drawTook', 'the.drawTook')
81
 
                 self.console:watch('recorder state', 'the.recorder.state')
82
 
              end
 
56
              self.view = GameView:new()
 
57
              self.console:watch('onGround', 'the.player.onGround')
 
58
              self.console:watch('onWall', 'the.player.onWall')
 
59
              self.console:watch('updateTook', 'the.updateTook')
 
60
              self.console:watch('drawTook', 'the.drawTook')
 
61
              self.console:watch('recorder state', 'the.recorder.state')
83
62
 
84
63
              --the.profiler = newProfiler('time', 2000)
85
64
              --the.profiler = newProfiler()
94
73
                       outfile:close()
95
74
                    end
96
75
 
97
 
                    if self.record and the.recorder then
 
76
                    if self.record then
98
77
                       if not love.filesystem.remove('record.lua') then
99
78
                          print('could not remove record.lua')
100
79
                       end