/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 16:04:57 UTC
  • Revision ID: josh@9ix.org-20130825160457-m0le8k88t0i2ooun
win screen activate!

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
require 'zoetrope'
5
5
--require 'pepperprof'
6
6
 
7
 
--require 'group'
8
 
 
9
7
require 'version'
10
 
--require 'wrap_tile'
11
8
require 'player'
12
9
require 'goal'
 
10
require 'pause_view'
 
11
require 'win_view'
13
12
 
14
13
GameView = View:extend {
15
14
   gameStart = 0,
31
30
              self.maze3.playerScale = 1
32
31
 
33
32
              self.goals = {}
 
33
              the.goalsAchieved = 0
34
34
              for _, obj in ipairs(self.objects.sprites) do
35
35
                 if obj:instanceOf(Goal) then
36
36
                    obj.visible = false
58
58
                 end
59
59
 
60
60
                 if not (DEBUG and the.console.visible) then
61
 
                    the.activeMaze:collide(the.player)
62
 
                    the.player:collide(the.activeGoal)
 
61
                    the.activeMaze:collide(the.player.collider)
 
62
                    the.player.collider:collide(the.activeGoal)
63
63
                 end
64
64
 
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
 
65
                 if the.keys:justPressed('escape', 'q') then
 
66
                    PauseView:new():activate()
 
67
                 --elseif the.keys:justPressed('w') then
 
68
                 --   WinView:new():activate()
 
69
                 end
71
70
              end,
72
71
   switchMaze = function(self)
73
72
                   if the.activeMaze then
97
96
                      the.activeGoal.visible = true
98
97
                   end
99
98
                   the.player.scale = the.activeMaze.playerScale
 
99
                   the.player.collider.width = the.player.width * the.activeMaze.playerScale
 
100
                   the.player.collider.height = the.player.height * the.activeMaze.playerScale
100
101
 
101
102
                   self._fx = {0,0,0,0}
102
103
                   self.tween:start(self._fx, 4, 175, 10, 'quadIn')
137
138
              end
138
139
           end,
139
140
   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
150
141
              end
151
142
}