/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 01:24:54 UTC
  • Revision ID: josh@9ix.org-20130428012454-b7kpooluezexnvde
fadeĀ out

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
              the.player = self
5
5
 
6
6
              self.movementScale = self.height / 32
 
7
              --print(self.movementScale)
7
8
 
8
9
              --self.scale = self.scaleHeight / self.height
9
10
              --self.width = self.height * .826
11
12
              --self:updateQuad()
12
13
           end,
13
14
   onStartFrame = function(self)
 
15
                     local ms = self.movementScale
 
16
                     if DEBUG and the.console.visible then
 
17
                        ms = ms * 4
 
18
                     end
 
19
 
14
20
                     if the.keys:pressed('up') then
15
 
                        self.velocity.y = -100
 
21
                        self.velocity.y = -100 * ms
16
22
                     elseif the.keys:pressed('down') then
17
 
                        self.velocity.y = 100
 
23
                        self.velocity.y = 100 * ms
18
24
                     else
19
25
                        self.velocity.y = 0
20
26
                     end
21
27
 
22
28
                     if the.keys:pressed('right') then
23
 
                        self.velocity.x = 100
 
29
                        self.velocity.x = 100 * ms
24
30
                     elseif the.keys:pressed('left') then
25
 
                        self.velocity.x = -100
 
31
                        self.velocity.x = -100 * ms
26
32
                     else
27
33
                        self.velocity.x = 0
28
34
                     end
29
 
                  end
 
35
                  end,
 
36
   onUpdate = function(self, dt)
 
37
                 self:collide(the.view)
 
38
              end,
 
39
   onEndFrame = function(self)
 
40
                   if self.y < self.minY then
 
41
                      self.y = self.minY
 
42
                   end
 
43
                   if self.y > self.maxY then
 
44
                      self.y = self.maxY
 
45
                   end
 
46
                end
30
47
}
 
 
b'\\ No newline at end of file'