/ld26

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

« back to all changes in this revision

Viewing changes to player.lua

  • Committer: Josh C
  • Date: 2013-04-29 01:54:19 UTC
  • Revision ID: josh@9ix.org-20130429015419-8ts0gwspqonsxkjb
Tags: compo
nameĀ theĀ game

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
Player = Tile:extend {
2
2
   image = 'data/player-null.png',
 
3
   minY = 0, maxY = 600,
 
4
   canMove = true,
3
5
   onNew = function(self)
4
6
              the.player = self
5
7
 
17
19
                        ms = ms * 4
18
20
                     end
19
21
 
20
 
                     if the.keys:pressed('up') then
21
 
                        self.velocity.y = -100 * ms
22
 
                     elseif the.keys:pressed('down') then
23
 
                        self.velocity.y = 100 * ms
24
 
                     else
25
 
                        self.velocity.y = 0
26
 
                     end
 
22
                     if self.canMove then
 
23
                        if the.keys:pressed('up') then
 
24
                           self.velocity.y = -100 * ms
 
25
                        elseif the.keys:pressed('down') then
 
26
                           self.velocity.y = 100 * ms
 
27
                        else
 
28
                           self.velocity.y = 0
 
29
                        end
27
30
 
28
 
                     if the.keys:pressed('right') then
29
 
                        self.velocity.x = 100 * ms
30
 
                     elseif the.keys:pressed('left') then
31
 
                        self.velocity.x = -100 * ms
32
 
                     else
33
 
                        self.velocity.x = 0
 
31
                        if the.keys:pressed('right') then
 
32
                           self.velocity.x = 100 * ms
 
33
                        elseif the.keys:pressed('left') then
 
34
                           self.velocity.x = -100 * ms
 
35
                        else
 
36
                           self.velocity.x = 0
 
37
                        end
34
38
                     end
35
39
                  end,
36
40
   onUpdate = function(self, dt)