/zoeplat

To get this branch, use:
bzr branch http://9ix.org/bzr/zoeplat

« back to all changes in this revision

Viewing changes to main.lua

  • Committer: Josh C
  • Date: 2013-03-05 00:14:58 UTC
  • Revision ID: josh@9ix.org-20130305001458-206jxv29dgeenj3n
jump

Show diffs side-by-side

added added

removed removed

Lines of Context:
10
10
   onNew = function (self)
11
11
              self.velocity.y = 0
12
12
           end,
13
 
   onStartFrame = function (self)
14
 
                     -- this is all in startframe so it happens before
15
 
                     -- physics calc at beginning of update
 
13
   onUpdate = function (self)
16
14
 
17
15
                 self.velocity.x = 0
18
 
                 -- TODO: this can be replaced with sprite.maxVel.y    
19
16
                 if self.velocity.y >= TERM_VEL then
20
17
                    self.velocity.y = TERM_VEL
21
18
                    self.acceleration.y = 0
32
29
                 if the.keys:justPressed('up') then
33
30
                    self.velocity.y = -400
34
31
                 end
35
 
              end,
36
 
   onUpdate = function (self)
37
 
                 -- this is called after physics, so this makes sense here
38
 
                 the.view.map:subdisplace(self)
 
32
 
39
33
              end
40
34
}
41
35
 
44
38
              self:loadLayers('data/map.lua')
45
39
              self.focus = the.player
46
40
              self:clampTo(self.map)
47
 
           end
 
41
           end,
 
42
 
 
43
   onEndFrame = function (self, dt)
 
44
                   self.map:subdisplace(the.player)
 
45
                end
48
46
}
49
47
 
50
48
the.app = App:new {