/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-10 21:55:44 UTC
  • Revision ID: josh@9ix.org-20130310215544-iqzp3x2l10h9247f
reorganize code - separate X and Y physics so we can collide in each 
direction separately

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
                     if self.falling then self.jumping = false end
71
71
                     --print(self.jumping, self.falling)
72
72
 
73
 
                     if (not self.onGround) and (not self.onWall) then
 
73
                     if not self.onGround then
74
74
                        self:play('jump')
75
75
                     end
76
76
 
77
77
                     self.velocity.x = 0
78
78
                     self.acceleration.y = 800
79
79
 
80
 
                     if self.onWall then
81
 
                        self.acceleration.y = 0
82
 
 
83
 
                        if the.keys:pressed('up') then
84
 
                           self.velocity.y = -200
85
 
                           self:play('stand')
86
 
                        elseif the.keys:pressed('down') then
87
 
                           self.velocity.y = 200
88
 
                           self:play('stand')
89
 
                        else
90
 
                           self.velocity.y = 0
91
 
                           self:play('stand')
92
 
                        end
93
 
                     end
94
 
 
95
80
                     if the.keys:pressed('left') then
96
81
                        self.velocity.x = -200
97
82
                        if self.onGround then self:play('walk') end
98
 
                        if self.onWall == 'right' then self.onWall = false end
99
 
                        if self.onWall == 'right' then self.onWall = false end
100
83
                     elseif the.keys:pressed('right') then
101
84
                        self.velocity.x = 200
102
85
                        if self.onGround then self:play('walk') end
103
 
                        if self.onWall == 'left' then self.onWall = false end
104
86
                     else
105
87
                        if self.onGround then self:play('stand') end
106
88
                     end
119
101
               self:doPhysics('y', elapsed)
120
102
 
121
103
               self:collide(the.view.map)
122
 
 
123
 
               Animation.update(self, elapsed)
124
104
            end,
125
105
   onCollide = function (self, other, xOverlap, yOverlap)
126
106
                  -- seriously, why does this even fire?