Skip to content

Commit

Permalink
Bouncing on enemies and trampolines also gets a hight bonus from airf…
Browse files Browse the repository at this point in the history
…lower
  • Loading branch information
LMH0013 committed Nov 15, 2014
1 parent a351cbf commit 114fd83
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 6 additions & 4 deletions src/object/player.cpp
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions src/object/trampoline.cpp
Expand Up @@ -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);
Expand Down

0 comments on commit 114fd83

Please sign in to comment.