/ld28

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

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-12-14 20:59:18 UTC
  • Revision ID: josh@9ix.org-20131214205918-w846mewpjguh3soj
align to grid

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
                       --print('key: ' .. keys[1])
24
24
                       self.queue:push_right(keys[1])
25
25
 
26
 
                       local inst = self.queue:pop_left()
27
 
                       if inst == 'left' then
 
26
                       self.direction = self.queue:pop_left()
 
27
                       if self.direction == 'left' then
28
28
                          self.x = self.x - self.width
29
 
                       elseif inst == 'right' then
 
29
                       elseif self.direction == 'right' then
30
30
                          self.x = self.x + self.width
31
 
                       elseif inst == 'up' then
 
31
                       elseif self.direction == 'up' then
32
32
                          self.y = self.y - self.height
33
 
                       elseif inst == 'down' then
 
33
                       elseif self.direction == 'down' then
34
34
                          self.y = self.y + self.height
35
35
                       end
36
36
 
37
37
                       self.moved = true
38
38
                    end
39
39
                 end
40
 
              end
 
40
              end,
 
41
   onCollide = function(self, other)
 
42
                  if other ~= the.view.map then
 
43
                     --print('collision')
 
44
 
 
45
                     other:displaceDir(self,
 
46
                                       util.dirToXY(self.direction),
 
47
                                       - util.dirToPosNeg(self.direction))
 
48
                  end
 
49
               end
41
50
}
 
 
b'\\ No newline at end of file'