/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:
12
12
   sequences = {
13
13
      stand = { frames = { 1 }, fps = 1 },
14
14
      walk = { frames = { 2, 3 }, fps = 5 },
15
 
      jump = { frames = { 4 }, fps = 1 }
 
15
      jump = { frames = { 4 }, fps = 1 },
 
16
      climbLeft = { frames = { 5, 6 }, fps = 5 },
 
17
      climbRight = { frames = { 7, 8 }, fps = 5 }
16
18
   },
17
19
   collisions = {},
18
20
   onWall = false,
81
83
                     if self.onWall then
82
84
                        self.acceleration.y = 0
83
85
 
 
86
                        if self.onWall == 'right' then
 
87
                           self:play('climbRight')
 
88
                        elseif self.onWall == 'left' then
 
89
                           self:play('climbLeft')
 
90
                        end
 
91
 
84
92
                        if the.keys:pressed('up') then
85
93
                           self.velocity.y = -200
86
 
                           self:play('stand')
87
94
                        elseif the.keys:pressed('down') then
88
95
                           self.velocity.y = 200
89
 
                           self:play('stand')
90
96
                        else
91
97
                           self.velocity.y = 0
92
 
                           self:play('stand')
 
98
                           self:freeze(self.sequences[self.currentName].frames[1])
93
99
                        end
94
100
                     end
95
101
 
102
108
                        if self.onGround then self:play('walk') end
103
109
                        if self.onWall == 'left' then self.onWall = false end
104
110
                     else
105
 
                        if self.onGround then self:play('stand') end
106
111
                        if not self.onWall then
 
112
                           if self.onGround then self:play('stand') end
107
113
                           self.velocity.x = 0
108
114
                        end
109
115
                     end