/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 22:25:26 UTC
  • Revision ID: josh@9ix.org-20130310222526-hrotq2ukxktjsrdg
climb walls

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 then
 
73
                     if (not self.onGround) and (not self.onWall) 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
 
80
95
                     if the.keys:pressed('left') then
81
96
                        self.velocity.x = -200
82
97
                        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
83
100
                     elseif the.keys:pressed('right') then
84
101
                        self.velocity.x = 200
85
102
                        if self.onGround then self:play('walk') end
 
103
                        if self.onWall == 'left' then self.onWall = false end
86
104
                     else
87
105
                        if self.onGround then self:play('stand') end
88
106
                     end
101
119
               self:doPhysics('y', elapsed)
102
120
 
103
121
               self:collide(the.view.map)
 
122
 
 
123
               Animation.update(self, elapsed)
104
124
            end,
105
125
   onCollide = function (self, other, xOverlap, yOverlap)
106
126
                  -- seriously, why does this even fire?