/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:48:42 UTC
  • Revision ID: josh@9ix.org-20130312174842-co8zn0hy0v6u18qf
climbing animation

Show diffs side-by-side

added added

removed removed

Lines of Context:
18
18
   },
19
19
   collisions = {},
20
20
   onWall = false,
21
 
   leftWallAt = 0,
22
21
   onNew = function (self)
23
22
              self.velocity.y = 0
24
23
              self.maxVelocity.y = 400
103
102
                     if the.keys:pressed('left') then
104
103
                        self.velocity.x = -200
105
104
                        if self.onGround then self:play('walk') end
106
 
                        if self.onWall == 'right' then
107
 
                           self.onWall = false
108
 
                           self.leftWallAt = love.timer.getTime()
109
 
                        end
 
105
                        if self.onWall == 'right' then self.onWall = false end
110
106
                     elseif the.keys:pressed('right') then
111
107
                        self.velocity.x = 200
112
108
                        if self.onGround then self:play('walk') end
113
 
                        if self.onWall == 'left' then
114
 
                           self.onWall = false
115
 
                           self.leftWallAt = love.timer.getTime()
116
 
                        end
 
109
                        if self.onWall == 'left' then self.onWall = false end
117
110
                     else
118
111
                        if not self.onWall then
119
112
                           if self.onGround then self:play('stand') end
121
114
                        end
122
115
                     end
123
116
 
124
 
                     if the.keys:justPressed('up') and
125
 
                      (self.onGround or
126
 
                       (love.timer.getTime() - self.leftWallAt < .1) ) then
 
117
                     if the.keys:justPressed('up') and self.onGround then
127
118
                        self.velocity.y = -400
128
119
                        self.jumping = true
129
120
                     end