/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-12-15 17:23:16 UTC
  • Revision ID: josh@9ix.org-20131215172316-aqwbhh3lyik48fnh
levels.  ish.

Show diffs side-by-side

added added

removed removed

Lines of Context:
42
42
                                   y = math.random(2, th-2) * 16
43
43
                                })
44
44
              end
45
 
 
46
 
              if self.level ~= 1 then
47
 
                 self:flash({0,0,0})
48
 
              end
49
45
           end,
50
46
   onUpdate = function(self, dt)
51
47
                 if the.player.moved then
 
48
                    -- this should encapsulate
 
49
 
52
50
                    the.clones:collide(the.player)
53
51
                    the.goalPerson:collide(the.player)
54
52
 
62
60
 
63
61
                    -- yeah, again.  once for flip, twice for displace
64
62
                    the.clones:collide(the.player)
65
 
                    the.goalPerson:collide(the.player) -- will this fix?
66
63
 
67
64
                    the.clones:collide(self.map)
68
65
                    the.player:collide(self.map)
79
76
 
80
77
                    the.player.moved = false
81
78
                 end
 
79
 
 
80
                 if the.keys:justPressed('escape', 'q') then
 
81
                    the.app:quit()
 
82
                 end
82
83
              end,
83
84
}
84
85
 
85
 
SlowView = View:extend {
86
 
   onNew = function(self)
87
 
              local text = Text:new {
88
 
                 text = 'Your movements have slowed...',
89
 
                 --height = the.app.height,
90
 
                 width = the.app.width,
91
 
                 align = 'center',
92
 
                 font = 18
93
 
              }
94
 
              text:centerAround(the.app.width / 2, the.app.height / 2)
95
 
              self:add(text)
96
 
 
97
 
              self.timer:after(2, function()
98
 
                 the.app.view = GameView:new{level = self.level}
99
 
              end)
100
 
           end
101
 
}
102
 
 
103
 
WinView = View:extend {
104
 
   onNew = function(self)
105
 
              local text = Text:new {
106
 
                 text = 'You win!',
107
 
                 width = the.app.width,
108
 
                 align = 'center',
109
 
                 font = 18
110
 
              }
111
 
              text:centerAround(the.app.width / 2, the.app.height / 2)
112
 
              self:add(text)
113
 
           end
114
 
}
115
 
 
116
 
TitleView = View:extend {
117
 
   onNew = function(self)
118
 
              self:add(Tile:new{
119
 
                          image = 'data/title.png'
120
 
                       })
121
 
           end,
122
 
   onUpdate = function(self)
123
 
                 if the.keys:allJustPressed() then
124
 
                    the.app.view = GameView:new{level = 1}
125
 
                 end
126
 
              end
127
 
}
128
 
 
129
86
the.app = App:new {
130
87
   name = "LD28",
131
88
   fps = 30,
132
89
   onRun = function (self)
133
90
              print('Version: ' .. VERSION)
134
91
 
135
 
              --self.view = GameView:new{level = 1}
136
 
              self.view = TitleView:new()
 
92
              self.view = GameView:new{level = 1}
137
93
 
138
94
              if DEBUG then
139
95
                 self.console:watch('VERSION', 'VERSION')
148
104
                    local ss = love.graphics.newScreenshot()
149
105
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
150
106
                 end
151
 
 
152
 
                 if the.keys:justPressed('escape', 'q') then
153
 
                    the.app:quit()
154
 
                 end
155
107
              end
156
108
}