/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 03:54:55 UTC
  • Revision ID: josh@9ix.org-20130824035455-upi2mnssckafqxgs
map loading, super basic movement

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.bg)
18
 
 
19
 
              self.mazes = {self.maze1, self.maze2}
20
 
              self.maze1:revive()
21
 
              self.maze2:die()
22
 
              the.activeMaze = self.maze1
 
17
              self:clampTo(self.map)
23
18
 
24
19
              --the.interface = Group:new()
25
20
 
26
21
              --self:add(the.interface)
27
22
 
28
 
              self.gameStart = love.timer.getMicroTime()
29
 
              self.lastChange = love.timer.getMicroTime()
 
23
              self.gameStart = love.timer.getTime()
 
24
              self.lastChange = love.timer.getTime()
30
25
           end,
31
26
   onUpdate = function(self, dt)
32
 
                 if the.player.active and love.timer.getMicroTime() > self.lastChange + 10 then
 
27
                 if the.player.active and love.timer.getTime() > self.lastChange + 10 then
33
28
                    -- 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()
41
29
 
42
 
                    self.lastChange = love.timer.getMicroTime()
 
30
                    self.lastChange = love.timer.getTime()
43
31
                 end
44
32
 
45
 
                 the.activeMaze:collide(the.player)
46
 
 
47
 
 
48
33
                 -- for _, mirror in ipairs(the.mirrors.sprites) do
49
34
                 --    if not mirror.of then
50
35
                 --       print('mirror:' .. inspect(mirror))