/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 16:38:21 UTC
  • Revision ID: josh@9ix.org-20130305163821-kw70drafjsh7329k
fix jitter caused by focus shift happening in the wrong order.  Looks 
like this is fixed in: 
https://bitbucket.org/klembot/zoetrope/commits/5e67ba491768caab0da8b9afc9954c072851e143

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