/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28
2 by Josh C
basic delayed movement
1
STRICT = true
2
DEBUG = true
3
4
require 'zoetrope'
5
deque = require 'deque'
6
7
require 'version'
8
require 'player'
7 by Josh C
rename NotPlayer to Clone cuz they're clones, and it's way too early
9
require 'clone'
2 by Josh C
basic delayed movement
10
11
GameView = View:extend {
12
   onNew = function (self)
13
              --self:loadLayers('data/map.lua')
14
              --self.focus = the.player
15
              --self:clampTo(self.bg)
16
3 by Josh C
add a couple other clones that move randomly
17
              the.player = Player:new{
18
                 x = math.random(the.app.width),
19
                 y = math.random(the.app.height),
20
              }
2 by Josh C
basic delayed movement
21
              self:add(the.player)
3 by Josh C
add a couple other clones that move randomly
22
7 by Josh C
rename NotPlayer to Clone cuz they're clones, and it's way too early
23
              the.clones = Group:new()
24
              self:add(the.clones)
4 by Josh C
more clones, no null movement
25
              for _ = 1, 14 do
7 by Josh C
rename NotPlayer to Clone cuz they're clones, and it's way too early
26
                 the.clones:add(Clone:new {
3 by Josh C
add a couple other clones that move randomly
27
                                       x = math.random(the.app.width),
28
                                       y = math.random(the.app.height),
29
                                    })
30
              end
2 by Josh C
basic delayed movement
31
           end,
32
   onUpdate = function(self, dt)
3 by Josh C
add a couple other clones that move randomly
33
                 if the.player.moved then
34
                    -- this should encapsulate
7 by Josh C
rename NotPlayer to Clone cuz they're clones, and it's way too early
35
                    for _, np in ipairs(the.clones.sprites) do
3 by Josh C
add a couple other clones that move randomly
36
                       np:doMove()
37
                    end
38
9 by Josh C
collision
39
                    the.clones:collide()
40
                    the.clones:collide(the.player)
41
3 by Josh C
add a couple other clones that move randomly
42
                    the.player.moved = false
43
                 end
44
2 by Josh C
basic delayed movement
45
                 if the.keys:justPressed('escape', 'q') then
46
                    the.app:quit()
47
                 end
48
              end,
49
}
50
51
the.app = App:new {
3 by Josh C
add a couple other clones that move randomly
52
   name = "LD28",
2 by Josh C
basic delayed movement
53
   onRun = function (self)
54
              print('Version: ' .. VERSION)
55
56
              self.view = GameView:new()
57
58
              if DEBUG then
59
                 self.console:watch('VERSION', 'VERSION')
60
61
                 -- back off that dark overlay a bit
62
                 self.console.fill.fill[4] = 75
63
              end
64
           end,
8 by Josh C
screenshots
65
   onUpdate = function (self, dt)
66
                 if the.keys:justPressed('f1') then
67
                    local ss = love.graphics.newScreenshot()
68
                    ss:encode('screenshot-' ..love.timer.getTime()..'.png')
69
                 end
70
              end
2 by Josh C
basic delayed movement
71
}