X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fobject%2Fplayer.cpp;h=d09b97fca1b99ceade0720b6ffb068a6f2117adb;hb=75acd4b141f45e851a492f089aa9ad24a9552409;hp=25c72c9c7caebdfcf47b1e516b08685801e13822;hpb=058e2f6298d8319c0fe03c5e950a36a8f1f57aba;p=supertux.git diff --git a/src/object/player.cpp b/src/object/player.cpp index 25c72c9c7..d09b97fca 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -372,17 +372,13 @@ Player::update(float elapsed_time) Vector ppos = Vector(px, py); Vector pspeed = Vector(0, 0); Vector paccel = Vector(0, 0); - // draw bright sparkle when there is lots of time left, dark sparkle when invincibility is about to end - if (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING) { - // make every other a longer sparkle to make trail a bit fuzzy - if (size_t(game_time*20)%2) { - Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "small", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); - } else { - Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "medium", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); - } - } else { - Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "dark", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); - } + Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", + // draw bright sparkle when there is lots of time left, dark sparkle when invincibility is about to end + (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING) ? + // make every other a longer sparkle to make trail a bit fuzzy + (size_t(game_time*20)%2) ? "small" : "medium" + : + "dark", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5)); } } @@ -417,9 +413,9 @@ Player::apply_friction() float friction = WALK_ACCELERATION_X * (on_ice ? ICE_FRICTION_MULTIPLIER : NORMAL_FRICTION_MULTIPLIER); if(physic.get_velocity_x() < 0) { physic.set_acceleration_x(friction); - } else /*if(physic.get_velocity_x() > 0)*/ { + } else if(physic.get_velocity_x() > 0) { physic.set_acceleration_x(-friction); - } + } // no friction for physic.get_velocity_x() == 0 } } @@ -688,16 +684,10 @@ Player::handle_input() } /* Peeking */ - if( controller->released( Controller::PEEK_LEFT ) ) { + if( controller->released( Controller::PEEK_LEFT ) || controller->released( Controller::PEEK_RIGHT ) ) { peekingX = AUTO; } - if( controller->released( Controller::PEEK_RIGHT ) ) { - peekingX = AUTO; - } - if( controller->released( Controller::PEEK_UP ) ) { - peekingY = AUTO; - } - if( controller->released( Controller::PEEK_DOWN ) ) { + if( controller->released( Controller::PEEK_UP ) || controller->released( Controller::PEEK_DOWN ) ) { peekingY = AUTO; } if( controller->pressed( Controller::PEEK_LEFT ) ) {