/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 18:36:53 UTC
  • Revision ID: josh@9ix.org-20131215183653-47wmq1ux17xspk93
intermidiate + win screens

Show diffs side-by-side

added added

removed removed

Lines of Context:
43
43
                                })
44
44
              end
45
45
 
46
 
              if self.level == 3 then
47
 
                 self:add(Text:new{
48
 
                             text = "R = Restart level",
49
 
                             x = 20, y = 20,
50
 
                             width = 200
51
 
                          })
52
 
              end
53
 
 
54
46
              if self.level ~= 1 then
55
47
                 self:flash({0,0,0})
56
48
              end
88
80
                    the.player.moved = false
89
81
                 end
90
82
 
91
 
                 if the.keys:justPressed('r') then
92
 
                    the.app.view = GameView:new{level = self.level}
 
83
                 if the.keys:justPressed('escape', 'q') then
 
84
                    the.app:quit()
93
85
                 end
94
86
              end,
95
87
}
96
88
 
97
89
SlowView = View:extend {
98
90
   onNew = function(self)
99
 
              local texts = {
100
 
                 '',
101
 
                 "Your movements have slowed...",
102
 
                 "Your movements have slowed...\nand they no longer only imitate you..."
103
 
              }
104
 
 
105
91
              local text = Text:new {
106
 
                 text = texts[self.level],
 
92
                 text = 'Your movements have slowed...',
107
93
                 --height = the.app.height,
108
94
                 width = the.app.width,
109
95
                 align = 'center',
131
117
           end
132
118
}
133
119
 
134
 
TitleView = View:extend {
135
 
   onNew = function(self)
136
 
              self:add(Tile:new{
137
 
                          image = 'data/title.png'
138
 
                       })
139
 
           end,
140
 
   onUpdate = function(self)
141
 
                 if the.keys:allJustPressed() then
142
 
                    the.app.view = GameView:new{level = 1}
143
 
                 end
144
 
              end
145
 
}
146
 
 
147
120
the.app = App:new {
148
 
   name = "One Among Many",
 
121
   name = "LD28",
149
122
   fps = 30,
150
123
   onRun = function (self)
151
124
              print('Version: ' .. VERSION)
152
125
 
153
 
              --self.view = GameView:new{level = 1}
154
 
              self.view = TitleView:new()
 
126
              self.view = GameView:new{level = 1}
 
127
              --self.view = SlowView:new{level = 1}
155
128
 
156
129
              if DEBUG then
157
130
                 self.console:watch('VERSION', 'VERSION')
166
139
                    local ss = love.graphics.newScreenshot()
167
140
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
168
141
                 end
169
 
 
170
 
                 if the.keys:justPressed('escape', 'q') then
171
 
                    the.app:quit()
172
 
                 end
173
142
              end
174
143
}