/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-28 23:55:40 UTC
  • Revision ID: josh@9ix.org-20130428235540-wamoh325zjypaf06
dragon flag special case

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
3
   minY = 0, maxY = 600,
4
 
   canMove = true,
5
4
   onNew = function(self)
6
5
              the.player = self
7
6
 
19
18
                        ms = ms * 4
20
19
                     end
21
20
 
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
 
21
                     if the.keys:pressed('up') then
 
22
                        self.velocity.y = -100 * ms
 
23
                     elseif the.keys:pressed('down') then
 
24
                        self.velocity.y = 100 * ms
 
25
                     else
 
26
                        self.velocity.y = 0
 
27
                     end
30
28
 
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
 
29
                     if the.keys:pressed('right') then
 
30
                        self.velocity.x = 100 * ms
 
31
                     elseif the.keys:pressed('left') then
 
32
                        self.velocity.x = -100 * ms
 
33
                     else
 
34
                        self.velocity.x = 0
38
35
                     end
39
36
                  end,
40
37
   onUpdate = function(self, dt)