/ld28

To get this branch, use:
bzr branch http://9ix.org/bzr/ld28
2 by Josh C
basic delayed movement
1
Player = Fill:extend {
2
   fill = {255,0,0},
3
   width = 16, height = 16,
4
   queue = deque.new(),
5
   onNew = function(self)
6
              for _ = 1, 4 do
7
                 self.queue:push_right('')
8
              end
9
           end,
10
   onStartFrame = function(self)
11
                     local keys = {the.keys:allJustPressed()}
12
                     for _, k in ipairs(keys) do
13
                        self.queue:push_right(k)
14
15
                        local inst = self.queue:pop_left()
16
                        if inst == 'left' then
17
                           self.x = self.x - self.width
18
                        elseif inst == 'right' then
19
                           self.x = self.x + self.width
20
                        elseif inst == 'up' then
21
                           self.y = self.y - self.height
22
                        elseif inst == 'down' then
23
                           self.y = self.y + self.height
24
                        end
25
                     end
26
                  end
27
}