Skip to content

Commit

Permalink
Prevents movement on conflicting input. Fixes hawkthorne#227
Browse files Browse the repository at this point in the history
  • Loading branch information
Jordan Hoff committed Sep 10, 2012
1 parent 0d3a6eb commit 7f44ed4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/nodes/floorspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function Floorspace.new(node, collider)
end

function Floorspace:update(dt, player)
if player.jumping or player.freeze then
if player.jumping or player.freeze or player.stopped then
return
end

Expand Down
7 changes: 7 additions & 0 deletions src/player.lua
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function Player.new(collider)
plyr.hand_offset = 10
plyr.freeze = false
plyr.mask = nil
plyr.stopped = false

plyr.holding = nil
plyr.holdable = nil
Expand Down Expand Up @@ -167,6 +168,12 @@ function Player:update(dt)
self.animations.warp:update(dt)
return
end

if ( crouching and gazing ) or ( movingLeft and movingRight ) then
self.stopped = true
else
self.stopped = false
end

-- taken from sonic physics http://info.sonicretro.org/SPG:Running
if movingLeft and not movingRight and not self.rebounding then
Expand Down

0 comments on commit 7f44ed4

Please sign in to comment.