/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 20:12:04 UTC
  • Revision ID: josh@9ix.org-20131215201204-k5ldifo4g8shxd3x
nameĀ theĀ game

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
 
46
54
              if self.level ~= 1 then
47
55
                 self:flash({0,0,0})
48
56
              end
80
88
                    the.player.moved = false
81
89
                 end
82
90
 
83
 
                 if the.keys:justPressed('escape', 'q') then
84
 
                    the.app:quit()
 
91
                 if the.keys:justPressed('r') then
 
92
                    the.app.view = GameView:new{level = self.level}
85
93
                 end
86
94
              end,
87
95
}
88
96
 
89
97
SlowView = View:extend {
90
98
   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
 
91
105
              local text = Text:new {
92
 
                 text = 'Your movements have slowed...',
 
106
                 text = texts[self.level],
93
107
                 --height = the.app.height,
94
108
                 width = the.app.width,
95
109
                 align = 'center',
117
131
           end
118
132
}
119
133
 
 
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
 
120
147
the.app = App:new {
121
 
   name = "LD28",
 
148
   name = "One Among Many",
122
149
   fps = 30,
123
150
   onRun = function (self)
124
151
              print('Version: ' .. VERSION)
125
152
 
126
 
              self.view = GameView:new{level = 1}
127
 
              --self.view = SlowView:new{level = 1}
 
153
              --self.view = GameView:new{level = 1}
 
154
              self.view = TitleView:new()
128
155
 
129
156
              if DEBUG then
130
157
                 self.console:watch('VERSION', 'VERSION')
139
166
                    local ss = love.graphics.newScreenshot()
140
167
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
141
168
                 end
 
169
 
 
170
                 if the.keys:justPressed('escape', 'q') then
 
171
                    the.app:quit()
 
172
                 end
142
173
              end
143
174
}