/ld27

To get this branch, use:
bzr branch http://9ix.org/bzr/ld27
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
local velLimit = 400
Player = Tile:extend{
   image = 'data/player.png',
   maxVelocity = {x=velLimit,y=velLimit},
   minVelocity = {x=-velLimit, y=-velLimit},
   onStartFrame = function(self)
                     if the.keys:pressed('left') then
                        self.velocity.x = -200
                     elseif the.keys:pressed('right') then
                        self.velocity.x = 200
                     else
                        self.velocity.x = 0
                     end

                     if the.keys:pressed('up') then
                        self.velocity.y = -200
                     elseif the.keys:pressed('down') then
                        self.velocity.y = 200
                     else
                        self.velocity.y = 0
                     end
                  end,
   onCollide = function(self, other)
                  other:displace(self)
               end
}