/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-12 17:21:28 UTC
  • Revision ID: josh@9ix.org-20130312172128-l336vwqawo81c6sm
really easy version of knowing when we reached the top of a wall.  
similar to how we're doing onGround.

Show diffs side-by-side

added added

removed removed

Lines of Context:
76
76
                        self:play('jump')
77
77
                     end
78
78
 
79
 
                     self.velocity.x = 0
80
79
                     self.acceleration.y = 800
81
80
 
82
81
                     if self.onWall then
98
97
                        self.velocity.x = -200
99
98
                        if self.onGround then self:play('walk') end
100
99
                        if self.onWall == 'right' then self.onWall = false end
101
 
                        if self.onWall == 'right' then self.onWall = false end
102
100
                     elseif the.keys:pressed('right') then
103
101
                        self.velocity.x = 200
104
102
                        if self.onGround then self:play('walk') end
105
103
                        if self.onWall == 'left' then self.onWall = false end
106
104
                     else
107
105
                        if self.onGround then self:play('stand') end
 
106
                        if not self.onWall then
 
107
                           self.velocity.x = 0
 
108
                        end
108
109
                     end
109
110
 
110
111
                     if the.keys:justPressed('up') and self.onGround then
119
120
               self:collide(the.view.map)
120
121
 
121
122
               -- handle X collisions
 
123
               self.onWall = false
122
124
               for _, col in ipairs(self.collisions) do
123
125
                  col.other:displaceDir(self, 'x')
124
126
                  if self.velocity.x > 0 then