Bouncing on enemies and trampolines also gets a hight bonus from airflower
authorLMH <lmh.0013@gmail.com>
Sat, 15 Nov 2014 23:10:37 +0000 (13:10 -1000)
committerLMH <lmh.0013@gmail.com>
Sat, 15 Nov 2014 23:10:37 +0000 (13:10 -1000)
src/object/player.cpp
src/object/trampoline.cpp

index c40a9ee..3af291c 100644 (file)
@@ -1511,10 +1511,12 @@ Player::get_velocity()
 void
 Player::bounce(BadGuy& )
 {
-  if(controller->hold(Controller::JUMP))
-    physic.set_velocity_y(-520);
-  else
-    physic.set_velocity_y(-300);
+  if(!(player_status->bonus == AIR_BONUS))
+    physic.set_velocity_y(controller->hold(Controller::JUMP) ? -520 : -300);
+  else {
+    physic.set_velocity_y(controller->hold(Controller::JUMP) ? -580 : -340);
+    glide_time = player_status->max_air_time * GLIDE_TIME_PER_FLOWER;
+  }
 }
 
 //scripting Functions Below
index b1c2fbc..b8d20ad 100644 (file)
@@ -83,11 +83,10 @@ Trampoline::collision(GameObject& other, const CollisionHit& hit)
       float vy = player->get_physic().get_velocity_y();
       //player is falling down on trampoline
       if(hit.top && vy >= 0) {
-        if(player->get_controller()->hold(Controller::JUMP)) {
-          vy = VY_MIN;
-        } else {
-          vy = VY_INITIAL;
-        }
+        if (!(player->get_status()->bonus == AIR_BONUS))
+          vy = player->get_controller()->hold(Controller::JUMP) ? VY_MIN : VY_INITIAL;
+        else
+          vy = player->get_controller()->hold(Controller::JUMP) ? VY_MIN - 300 : VY_INITIAL - 40;
         player->get_physic().set_velocity_y(vy);
         SoundManager::current()->play(TRAMPOLINE_SOUND);
         sprite->set_action("swinging", 1);