From 2c724d956885b092a2af90d59c0e1ea8684e4719 Mon Sep 17 00:00:00 2001 From: Ryan Flegel Date: Fri, 14 May 2004 08:36:13 +0000 Subject: [PATCH] - fixed [sorta] the mushroom bumping problems - is it okay to determine the direction from the player's position? SVN-Revision: 1175 --- src/special.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/special.cpp b/src/special.cpp index ab9874acd..fa9c4ff12 100644 --- a/src/special.cpp +++ b/src/special.cpp @@ -309,7 +309,7 @@ Upgrade::draw() } void -Upgrade::bump(Player* ) +Upgrade::bump(Player* player) { // these can't be bumped if(kind != UPGRADE_GROWUP) @@ -317,9 +317,14 @@ Upgrade::bump(Player* ) play_sound(sounds[SND_BUMP_UPGRADE], SOUND_CENTER_SPEAKER); + // determine new direction + if (player->base.x + player->base.width/2 > base.x + base.width/2) + dir = LEFT; + else + dir = RIGHT; + // do a little jump and change direction physic.set_velocity(-physic.get_velocity_x(), 3); - dir = dir == LEFT ? RIGHT : LEFT; physic.enable_gravity(true); } -- 2.11.0