/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-27 18:35:29 UTC
  • Revision ID: josh@9ix.org-20130427183529-0lqp56qq6m0yocn1
levels hash, scale player

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