/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:17:32 UTC
  • Revision ID: josh@9ix.org-20130427191732-b04lkepq9cz8e1n7
player min/maxY on a level

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
3
   onNew = function(self)
5
4
              the.player = self
6
5
 
7
6
              self.movementScale = self.height / 32
8
 
              --print(self.movementScale)
 
7
              print(self.movementScale)
9
8
 
10
9
              --self.scale = self.scaleHeight / self.height
11
10
              --self.width = self.height * .826
14
13
           end,
15
14
   onStartFrame = function(self)
16
15
                     local ms = self.movementScale
17
 
                     if DEBUG and the.console.visible then
18
 
                        ms = ms * 4
19
 
                     end
20
16
 
21
17
                     if the.keys:pressed('up') then
22
18
                        self.velocity.y = -100 * ms
34
30
                        self.velocity.x = 0
35
31
                     end
36
32
                  end,
37
 
   onUpdate = function(self, dt)
38
 
                 self:collide(the.view)
39
 
              end,
40
33
   onEndFrame = function(self)
41
34
                   if self.y < self.minY then
42
35
                      self.y = self.minY