/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:26:10 UTC
  • Revision ID: josh@9ix.org-20130825022610-13j6ydir3gmihiwz
.bzrignore

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)
66
 
                    the.player.collider:collide(the.activeGoal)
 
61
                    the.activeMaze:collide(the.player)
 
62
                    the.player: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
100
97
                      the.activeGoal.visible = true
101
98
                   end
102
99
                   the.player.scale = the.activeMaze.playerScale
103
 
                   the.player.collider.width = the.player.width * the.activeMaze.playerScale
104
 
                   the.player.collider.height = the.player.height * the.activeMaze.playerScale
105
100
 
106
101
                   self._fx = {0,0,0,0}
107
102
                   self.tween:start(self._fx, 4, 175, 10, 'quadIn')
136
131
 
137
132
              if DEBUG then
138
133
                 self.console:watch('VERSION', 'VERSION')
139
 
                 self.console:watch('player.x', 'the.player.x')
140
 
                 self.console:watch('player.y', 'the.player.y')
141
134
 
142
135
                 -- back off that dark overlay a bit
143
136
                 self.console.fill.fill[4] = 75
144
137
              end
145
138
           end,
146
139
   onUpdate = function (self, dt)
 
140
                 if the.keys:justPressed('escape') then
 
141
                    if the.profiler then
 
142
                       the.profiler:stop()
 
143
                       local outfile = io.open( "profile.txt", "w+" )
 
144
                       the.profiler:report( outfile )
 
145
                       outfile:close()
 
146
                    end
 
147
 
 
148
                    self.quit()
 
149
                 end
147
150
              end
148
151
}