/ld26

To get this branch, use:
bzr branch /bzr/ld26

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-04-27 17:09:45 UTC
  • Revision ID: josh@9ix.org-20130427170945-tdycmqprr0vu17ar
load a level, move a player around

Show diffs side-by-side

added added

removed removed

 
1
Player = Tile:extend {
 
2
   image = 'data/player1.png',
 
3
   onNew = function(self)
 
4
           end,
 
5
   onStartFrame = function(self)
 
6
                     if the.keys:pressed('up') then
 
7
                        self.velocity.y = -100
 
8
                     elseif the.keys:pressed('down') then
 
9
                        self.velocity.y = 100
 
10
                     else
 
11
                        self.velocity.y = 0
 
12
                     end
 
13
 
 
14
                     if the.keys:pressed('right') then
 
15
                        self.velocity.x = 100
 
16
                     elseif the.keys:pressed('left') then
 
17
                        self.velocity.x = -100
 
18
                     else
 
19
                        self.velocity.x = 0
 
20
                     end
 
21
                  end
 
22
}
 
 
'\\ No newline at end of file'