/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 19:55:06 UTC
  • Revision ID: josh@9ix.org-20130427195506-xd6p6y8druwyt2sz
area transitions

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
 
14
17
                     if the.keys:pressed('up') then
15
 
                        self.velocity.y = -100
 
18
                        self.velocity.y = -100 * ms
16
19
                     elseif the.keys:pressed('down') then
17
 
                        self.velocity.y = 100
 
20
                        self.velocity.y = 100 * ms
18
21
                     else
19
22
                        self.velocity.y = 0
20
23
                     end
21
24
 
22
25
                     if the.keys:pressed('right') then
23
 
                        self.velocity.x = 100
 
26
                        self.velocity.x = 100 * ms
24
27
                     elseif the.keys:pressed('left') then
25
 
                        self.velocity.x = -100
 
28
                        self.velocity.x = -100 * ms
26
29
                     else
27
30
                        self.velocity.x = 0
28
31
                     end
29
 
                  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
30
44
}
 
 
b'\\ No newline at end of file'