/ld27

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

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-08-25 02:38:46 UTC
  • Revision ID: josh@9ix.org-20130825023846-wgea9oh4n0o16gct
separate collision box for player so it can scale

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
 
4
4
require 'zoetrope'
5
5
--require 'pepperprof'
6
 
--inspect = require 'inspect'
7
6
 
8
 
require 'sprite'
9
 
require 'util'
 
7
--require 'group'
10
8
 
11
9
require 'version'
 
10
--require 'wrap_tile'
12
11
require 'player'
13
12
require 'goal'
14
 
require 'pause_view'
15
 
require 'win_view'
16
13
 
17
14
GameView = View:extend {
18
15
   gameStart = 0,
34
31
              self.maze3.playerScale = 1
35
32
 
36
33
              self.goals = {}
37
 
              the.goalsAchieved = 0
38
34
              for _, obj in ipairs(self.objects.sprites) do
39
35
                 if obj:instanceOf(Goal) then
40
36
                    obj.visible = false
62
58
                 end
63
59
 
64
60
                 if not (DEBUG and the.console.visible) then
65
 
                    --the.player.collider:collide(the.activeMaze)
 
61
                    the.activeMaze:collide(the.player.collider)
66
62
                    the.player.collider:collide(the.activeGoal)
67
63
                 end
68
64
 
69
 
                 if the.keys:justPressed('escape', 'q') then
70
 
                    PauseView:new():activate()
71
 
                 --elseif the.keys:justPressed('w') then
72
 
                 --   WinView:new():activate()
73
 
                 end
 
65
                 -- for _, mirror in ipairs(the.mirrors.sprites) do
 
66
                 --    if not mirror.of then
 
67
                 --       print('mirror:' .. inspect(mirror))
 
68
                 --       error('mirror OF NOTHING')
 
69
                 --    end
 
70
                 -- end
74
71
              end,
75
72
   switchMaze = function(self)
76
73
                   if the.activeMaze then
136
133
 
137
134
              if DEBUG then
138
135
                 self.console:watch('VERSION', 'VERSION')
139
 
                 self.console:watch('player.x', 'the.player.x')
140
 
                 self.console:watch('player.y', 'the.player.y')
141
136
 
142
137
                 -- back off that dark overlay a bit
143
138
                 self.console.fill.fill[4] = 75
144
139
              end
145
140
           end,
146
141
   onUpdate = function (self, dt)
 
142
                 if the.keys:justPressed('escape') then
 
143
                    if the.profiler then
 
144
                       the.profiler:stop()
 
145
                       local outfile = io.open( "profile.txt", "w+" )
 
146
                       the.profiler:report( outfile )
 
147
                       outfile:close()
 
148
                    end
 
149
 
 
150
                    self.quit()
 
151
                 end
147
152
              end
148
153
}