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