/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 22:47:18 UTC
  • Revision ID: josh@9ix.org-20130825224718-c93zymxgkm9r3kjh
play silly sound on level switch

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
              self.maze2.playerScale = 0.5
35
35
              self.maze3.playerScale = 1
36
36
 
37
 
              self.goals = {{},{},{}}
 
37
              self.goals = {}
38
38
              the.goalsAchieved = 0
39
39
              for _, obj in ipairs(self.objects.sprites) do
40
40
                 if obj:instanceOf(Goal) then
41
41
                    obj.visible = false
42
 
                    table.insert(self.goals[tonumber(obj.map)], obj)
 
42
                    self.goals[tonumber(obj.map)] = obj
43
43
                 end
44
44
              end
45
45
 
70
70
                 end
71
71
 
72
72
                 if not (DEBUG and the.console.visible) then
73
 
                    for _, goal in ipairs(the.activeGoals) do
74
 
                       the.player.collider:collide(goal)
75
 
                    end
 
73
                    --the.player.collider:collide(the.activeMaze)
 
74
                    the.player.collider:collide(the.activeGoal)
76
75
                 end
77
76
 
78
77
                 if the.keys:justPressed('escape', 'q') then
93
92
                      the.activeBg.visible = false
94
93
                      the.activeBg = self.bgs[newMaze]
95
94
 
96
 
                      for _, goal in ipairs(the.activeGoals) do
97
 
                         goal.visible = false
 
95
                      if the.activeGoal then
 
96
                         the.activeGoal.visible = false
98
97
                      end
99
 
                      the.activeGoals = self.goals[newMaze]
 
98
                      the.activeGoal = self.goals[newMaze]
100
99
 
101
100
                      love.audio.play(self.switchSounds[math.random(#self.switchSounds)])
102
101
                   else
103
102
                      the.activeMaze = self.maze2
104
103
                      the.activeBg = self.bg
105
 
                      the.activeGoals = self.goals[2]
 
104
                      the.activeGoal = self.goals[2]
106
105
                   end
107
106
 
108
107
                   the.activeMaze:revive()
109
108
                   the.activeBg.visible = true
110
 
                   for _, goal in ipairs(the.activeGoals) do
111
 
                      goal.visible = true
 
109
                   if the.activeGoal then
 
110
                      the.activeGoal.visible = true
112
111
                   end
113
112
                   the.player.scale = the.activeMaze.playerScale
114
113
                   the.player.collider.width = the.player.width * the.activeMaze.playerScale
143
142
                       })
144
143
 
145
144
              self:add(Text:new{
146
 
                          text = 'Find the 4 lost shinies!',
 
145
                          text = 'Find the 3 lost shinies!',
147
146
                          y = 170,
148
147
                          width = self.bg.width,
149
148
                          font = {nr, 28},