Tux can stop to backflip when landing on objects. Holding jump still continues backfl...
authorWolfgang Becker <uafr@gmx.de>
Thu, 29 Aug 2013 16:28:09 +0000 (18:28 +0200)
committerTobias Markus <tobbi@mozilla-uk.org>
Sat, 26 Oct 2013 16:45:19 +0000 (18:45 +0200)
src/object/player.cpp

index 427c653..11dd4d9 100644 (file)
@@ -1253,6 +1253,12 @@ Player::collision(GameObject& other, const CollisionHit& hit)
     return FORCE_MOVE;
   }
 
+  if( backflipping && hit.bottom && ( !controller->hold(Controller::JUMP) ) ){
+    // allow to stop backflipping when landing on objects
+    backflipping = false;
+    backflip_direction = 0;
+  }
+
   BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
   if(badguy != NULL) {
     if(safe_timer.started() || invincible_timer.started())