From: LMH Date: Sat, 8 Mar 2014 20:46:57 +0000 (-1000) Subject: A more elegant approach to backflip animation. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=f8a53829ebdb72bd7deffa1d249b71625e84a10a;p=supertux.git A more elegant approach to backflip animation. Backflip no longer uses several images that have been previously rotated, instead a single image is used and the sprite is rotated. --- diff --git a/WHATSNEW.txt b/WHATSNEW.txt index 26dee86b7..0ba7ff4e8 100644 --- a/WHATSNEW.txt +++ b/WHATSNEW.txt @@ -6,6 +6,10 @@ glow effects new badguys: iceflame, ghostflame, livefire, goldbomb, smartblock new bonuses: coinrain, coinexplode statistics improved +icy island levels tweaked +new sounds +massive improvements to localization +efficiency tweaks Supertux Release 0.3.4 (2013-07) -------------------------------- diff --git a/data/images/creatures/tux/big/backflip-0.png b/data/images/creatures/tux/big/backflip-0.png deleted file mode 100644 index ea1a12030..000000000 Binary files a/data/images/creatures/tux/big/backflip-0.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-1.png b/data/images/creatures/tux/big/backflip-1.png deleted file mode 100644 index f407f14b2..000000000 Binary files a/data/images/creatures/tux/big/backflip-1.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-2.png b/data/images/creatures/tux/big/backflip-2.png deleted file mode 100644 index cdb74c413..000000000 Binary files a/data/images/creatures/tux/big/backflip-2.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-3.png b/data/images/creatures/tux/big/backflip-3.png deleted file mode 100644 index 136eeb08f..000000000 Binary files a/data/images/creatures/tux/big/backflip-3.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-4.png b/data/images/creatures/tux/big/backflip-4.png deleted file mode 100644 index d8953ff33..000000000 Binary files a/data/images/creatures/tux/big/backflip-4.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-5.png b/data/images/creatures/tux/big/backflip-5.png deleted file mode 100644 index c45c115cb..000000000 Binary files a/data/images/creatures/tux/big/backflip-5.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-6.png b/data/images/creatures/tux/big/backflip-6.png deleted file mode 100644 index a72711239..000000000 Binary files a/data/images/creatures/tux/big/backflip-6.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-7.png b/data/images/creatures/tux/big/backflip-7.png deleted file mode 100644 index 035054203..000000000 Binary files a/data/images/creatures/tux/big/backflip-7.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip-8.png b/data/images/creatures/tux/big/backflip-8.png deleted file mode 100644 index ea1a12030..000000000 Binary files a/data/images/creatures/tux/big/backflip-8.png and /dev/null differ diff --git a/data/images/creatures/tux/big/backflip.png b/data/images/creatures/tux/big/backflip.png new file mode 100644 index 000000000..ea1a12030 Binary files /dev/null and b/data/images/creatures/tux/big/backflip.png differ diff --git a/data/images/creatures/tux/fire/backflip-0.png b/data/images/creatures/tux/fire/backflip-0.png deleted file mode 100644 index ac15e104b..000000000 Binary files a/data/images/creatures/tux/fire/backflip-0.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-1.png b/data/images/creatures/tux/fire/backflip-1.png deleted file mode 100644 index 8ed77ddec..000000000 Binary files a/data/images/creatures/tux/fire/backflip-1.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-2.png b/data/images/creatures/tux/fire/backflip-2.png deleted file mode 100644 index 82ea69000..000000000 Binary files a/data/images/creatures/tux/fire/backflip-2.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-3.png b/data/images/creatures/tux/fire/backflip-3.png deleted file mode 100644 index 2f09dfeef..000000000 Binary files a/data/images/creatures/tux/fire/backflip-3.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-4.png b/data/images/creatures/tux/fire/backflip-4.png deleted file mode 100644 index 59c868b68..000000000 Binary files a/data/images/creatures/tux/fire/backflip-4.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-5.png b/data/images/creatures/tux/fire/backflip-5.png deleted file mode 100644 index d822b9f01..000000000 Binary files a/data/images/creatures/tux/fire/backflip-5.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-6.png b/data/images/creatures/tux/fire/backflip-6.png deleted file mode 100644 index 43c5bfcf2..000000000 Binary files a/data/images/creatures/tux/fire/backflip-6.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-7.png b/data/images/creatures/tux/fire/backflip-7.png deleted file mode 100644 index eecb3bd6d..000000000 Binary files a/data/images/creatures/tux/fire/backflip-7.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip-8.png b/data/images/creatures/tux/fire/backflip-8.png deleted file mode 100644 index ac15e104b..000000000 Binary files a/data/images/creatures/tux/fire/backflip-8.png and /dev/null differ diff --git a/data/images/creatures/tux/fire/backflip.png b/data/images/creatures/tux/fire/backflip.png new file mode 100644 index 000000000..ac15e104b Binary files /dev/null and b/data/images/creatures/tux/fire/backflip.png differ diff --git a/data/images/creatures/tux/ice/backflip-0.png b/data/images/creatures/tux/ice/backflip-0.png deleted file mode 100644 index 599563074..000000000 Binary files a/data/images/creatures/tux/ice/backflip-0.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-1.png b/data/images/creatures/tux/ice/backflip-1.png deleted file mode 100644 index 7e2800d89..000000000 Binary files a/data/images/creatures/tux/ice/backflip-1.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-2.png b/data/images/creatures/tux/ice/backflip-2.png deleted file mode 100644 index 423df4e4e..000000000 Binary files a/data/images/creatures/tux/ice/backflip-2.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-3.png b/data/images/creatures/tux/ice/backflip-3.png deleted file mode 100644 index 2f3119c3f..000000000 Binary files a/data/images/creatures/tux/ice/backflip-3.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-4.png b/data/images/creatures/tux/ice/backflip-4.png deleted file mode 100644 index abeca32cb..000000000 Binary files a/data/images/creatures/tux/ice/backflip-4.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-5.png b/data/images/creatures/tux/ice/backflip-5.png deleted file mode 100644 index e173247b4..000000000 Binary files a/data/images/creatures/tux/ice/backflip-5.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-6.png b/data/images/creatures/tux/ice/backflip-6.png deleted file mode 100644 index 8070458e0..000000000 Binary files a/data/images/creatures/tux/ice/backflip-6.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-7.png b/data/images/creatures/tux/ice/backflip-7.png deleted file mode 100644 index 08c268dc0..000000000 Binary files a/data/images/creatures/tux/ice/backflip-7.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip-8.png b/data/images/creatures/tux/ice/backflip-8.png deleted file mode 100644 index 599563074..000000000 Binary files a/data/images/creatures/tux/ice/backflip-8.png and /dev/null differ diff --git a/data/images/creatures/tux/ice/backflip.png b/data/images/creatures/tux/ice/backflip.png new file mode 100644 index 000000000..599563074 Binary files /dev/null and b/data/images/creatures/tux/ice/backflip.png differ diff --git a/data/images/creatures/tux/tux.sprite b/data/images/creatures/tux/tux.sprite index 3ca21354b..0f154ba56 100644 --- a/data/images/creatures/tux/tux.sprite +++ b/data/images/creatures/tux/tux.sprite @@ -223,29 +223,7 @@ (action (name "big-backflip-right") (hitbox 16 37 32 32) - (fps 18.0) - (images "big/backflip-0.png" - "big/backflip-1.png" - "big/backflip-2.png" - "big/backflip-3.png" - "big/backflip-4.png" - "big/backflip-5.png" - "big/backflip-6.png" - "big/backflip-7.png" - "big/backflip-8.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png" - "big/backflip-0.png")) + (images "big/backflip.png")) (action (name "big-backflip-left") @@ -367,29 +345,7 @@ (action (name "fire-backflip-right") (hitbox 16 37 32 32) - (fps 18.0) - (images "fire/backflip-0.png" - "fire/backflip-1.png" - "fire/backflip-2.png" - "fire/backflip-3.png" - "fire/backflip-4.png" - "fire/backflip-5.png" - "fire/backflip-6.png" - "fire/backflip-7.png" - "fire/backflip-8.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png" - "fire/backflip-0.png")) + (images "fire/backflip.png")) (action (name "fire-backflip-left") @@ -511,29 +467,7 @@ (action (name "ice-backflip-right") (hitbox 16 37 32 32) - (fps 18.0) - (images "ice/backflip-0.png" - "ice/backflip-1.png" - "ice/backflip-2.png" - "ice/backflip-3.png" - "ice/backflip-4.png" - "ice/backflip-5.png" - "ice/backflip-6.png" - "ice/backflip-7.png" - "ice/backflip-8.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png" - "ice/backflip-0.png")) + (images "ice/backflip.png")) (action (name "ice-backflip-left") diff --git a/src/object/player.cpp b/src/object/player.cpp index a40897536..2cc156e31 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -213,6 +213,7 @@ Player::init() deactivated = false; backflipping = false; backflip_direction = 0; + sprite->set_angle(0.0f); visible = true; swimming = false; on_ice = false; @@ -323,6 +324,7 @@ Player::trigger_sequence(std::string sequence_name) if (climbing) stop_climbing(*climbing); backflipping = false; backflip_direction = 0; + sprite->set_angle(0.0f); GameSession::current()->start_sequence(sequence_name); } @@ -369,6 +371,8 @@ Player::update(float elapsed_time) //prevent player from changing direction when backflipping dir = (backflip_direction == 1) ? LEFT : RIGHT; if (backflip_timer.started()) physic.set_velocity_x(100 * backflip_direction); + //rotate sprite during flip + sprite->set_angle(sprite->get_angle() + (dir==LEFT?1:-1) * elapsed_time * (360.0f / 0.5f)); } // set fall mode... @@ -388,6 +392,7 @@ Player::update(float elapsed_time) if (backflipping && (backflip_timer.get_timegone() > 0.15f)) { backflipping = false; backflip_direction = 0; + sprite->set_angle(0.0f); // if controls are currently deactivated, we take care of standing up ourselves if (deactivated) @@ -835,6 +840,7 @@ Player::handle_input() if( backflipping && ( !controller->hold(Controller::JUMP) && !backflip_timer.started()) ){ backflipping = false; backflip_direction = 0; + sprite->set_angle(0.0f); } } @@ -1309,6 +1315,7 @@ Player::kill(bool completely) adjust_height(SMALL_TUX_HEIGHT); duck = false; backflipping = false; + sprite->set_angle(0.0f); set_bonus(NO_BONUS, true); } else if(player_status->bonus == NO_BONUS) { safe_timer.start(TUX_SAFE_TIME); @@ -1368,6 +1375,7 @@ Player::move(const Vector& vector) set_size(TUX_WIDTH, SMALL_TUX_HEIGHT); duck = false; backflipping = false; + sprite->set_angle(0.0f); last_ground_y = vector.y; if (climbing) stop_climbing(*climbing); @@ -1498,6 +1506,7 @@ Player::start_climbing(Climbable& climbable) if (backflipping) { backflipping = false; backflip_direction = 0; + sprite->set_angle(0.0f); } }