/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 14:44:15 UTC
  • Revision ID: josh@9ix.org-20130824144415-xzsu07vmws2jx7vk
fade in to let you know change is coming

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:switchMaze()
 
29
 
 
30
              self.gameStart = love.timer.getMicroTime()
 
31
              self.lastChange = love.timer.getMicroTime()
25
32
           end,
26
33
   onUpdate = function(self, dt)
27
 
                 if the.player.active and love.timer.getTime() > self.lastChange + 10 then
 
34
                 if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
28
35
                    -- switch maze
29
 
 
30
 
                    self.lastChange = love.timer.getTime()
 
36
                    self:switchMaze()
31
37
                 end
32
38
 
 
39
                 the.activeMaze:collide(the.player)
 
40
 
 
41
 
33
42
                 -- for _, mirror in ipairs(the.mirrors.sprites) do
34
43
                 --    if not mirror.of then
35
44
                 --       print('mirror:' .. inspect(mirror))
37
46
                 --    end
38
47
                 -- end
39
48
              end,
 
49
   switchMaze = function(self)
 
50
                   the.activeMaze:die()
 
51
                   if the.activeMaze == self.maze1 then
 
52
                      the.activeMaze = self.maze2
 
53
                   else
 
54
                      the.activeMaze = self.maze1
 
55
                   end
 
56
                   the.activeMaze:revive()
 
57
 
 
58
                   self._fx = {255,255,255,0}
 
59
                   self.tween:start(self._fx, 4, 150, 10, 'quadIn')
 
60
 
 
61
                   self.lastChange = love.timer.getMicroTime()
 
62
                end,
40
63
   onEndFrame = function(self)
41
64
                   --the.interface.translate.x = the.player.x - the.app.width / 2 + the.player.width / 2
42
65
                   --the.interface.translate.y = the.player.y - the.app.height / 2 + the.player.height / 2