/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-24 04:11:48 UTC
  • Revision ID: josh@9ix.org-20130824041148-npjyxboq6urktc8w
switch mazes

Show diffs side-by-side

added added

removed removed

Lines of Context:
14
14
   onNew = function (self)
15
15
              self:loadLayers('data/map.lua')
16
16
              self.focus = the.player
17
 
              self:clampTo(self.map)
 
17
              self:clampTo(self.bg)
 
18
 
 
19
              self.mazes = {self.maze1, self.maze2}
 
20
              self.maze1:revive()
 
21
              self.maze2:die()
 
22
              the.activeMaze = self.maze1
18
23
 
19
24
              --the.interface = Group:new()
20
25
 
21
26
              --self:add(the.interface)
22
27
 
23
 
              self.gameStart = love.timer.getTime()
24
 
              self.lastChange = love.timer.getTime()
 
28
              self.gameStart = love.timer.getMicroTime()
 
29
              self.lastChange = love.timer.getMicroTime()
25
30
           end,
26
31
   onUpdate = function(self, dt)
27
 
                 if the.player.active and love.timer.getTime() > self.lastChange + 10 then
 
32
                 if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
28
33
                    -- switch maze
 
34
                    the.activeMaze:die()
 
35
                    if the.activeMaze == self.maze1 then
 
36
                       the.activeMaze = self.maze2
 
37
                    else
 
38
                       the.activeMaze = self.maze1
 
39
                    end
 
40
                    the.activeMaze:revive()
29
41
 
30
 
                    self.lastChange = love.timer.getTime()
 
42
                    self.lastChange = love.timer.getMicroTime()
31
43
                 end
32
44
 
 
45
                 the.activeMaze:collide(the.player)
 
46
 
 
47
 
33
48
                 -- for _, mirror in ipairs(the.mirrors.sprites) do
34
49
                 --    if not mirror.of then
35
50
                 --       print('mirror:' .. inspect(mirror))