From: LMH Date: Sun, 14 Dec 2014 14:57:18 +0000 (-1000) Subject: Sprite action work for powerup hats: climbing, backflip. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=a5833e9320250ce1d2f1d6da7510a8ae8d263a73;p=supertux.git Sprite action work for powerup hats: climbing, backflip. Still need to finish sprite actions for duck and skid. Note that climbing action for Tux really needs some work in general. --- diff --git a/data/images/creatures/tux/air/hat/backflip.png b/data/images/creatures/tux/air/hat/backflip.png new file mode 100644 index 000000000..ac5c1e520 Binary files /dev/null and b/data/images/creatures/tux/air/hat/backflip.png differ diff --git a/data/images/creatures/tux/earth/hardhat/backflip.png b/data/images/creatures/tux/earth/hardhat/backflip.png new file mode 100644 index 000000000..6016f2318 Binary files /dev/null and b/data/images/creatures/tux/earth/hardhat/backflip.png differ diff --git a/data/images/creatures/tux/earth/light/backflip.png b/data/images/creatures/tux/earth/light/backflip.png new file mode 100644 index 000000000..b13a4c2c3 Binary files /dev/null and b/data/images/creatures/tux/earth/light/backflip.png differ diff --git a/data/images/creatures/tux/earth/light/duck.png b/data/images/creatures/tux/earth/light/duck.png new file mode 100644 index 000000000..e8fd1323b Binary files /dev/null and b/data/images/creatures/tux/earth/light/duck.png differ diff --git a/data/images/creatures/tux/light.sprite b/data/images/creatures/tux/light.sprite index ea6edcdf4..2c08afff6 100644 --- a/data/images/creatures/tux/light.sprite +++ b/data/images/creatures/tux/light.sprite @@ -72,18 +72,18 @@ (action (name "earth-climbing-right") - (hitbox 516 134 32 64) + (hitbox 522 141 32 64) (images "earth/light/stand.png")) (action (name "earth-climbing-left") - (hitbox 516 134 32 64) + (hitbox 522 141 32 64) (mirror-action "earth-climbing-right")) (action (name "earth-duck-right") (hitbox 516 134 32 64) - (images "earth/light/stand.png")) + (images "earth/light/duck.png")) (action (name "earth-duck-left") @@ -92,12 +92,12 @@ (action (name "earth-backflip-right") - (hitbox 516 134 32 64) - (images "earth/light/stand.png")) + (hitbox 516 537 32 32) + (images "earth/light/backflip.png")) (action (name "earth-backflip-left") - (hitbox 516 134 32 64) + (hitbox 516 537 32 32) (mirror-action "earth-backflip-right")) (action diff --git a/data/images/creatures/tux/powerups.sprite b/data/images/creatures/tux/powerups.sprite index 2be5745f9..49d1b123f 100644 --- a/data/images/creatures/tux/powerups.sprite +++ b/data/images/creatures/tux/powerups.sprite @@ -86,12 +86,12 @@ (action (name "air-climbing-right") - (hitbox 16 14 32 64) + (hitbox 22 21 32 64) (images "air/hat/stand.png")) (action (name "air-climbing-left") - (hitbox 16 14 32 64) + (hitbox 22 21 32 64) (mirror-action "air-climbing-right")) (action @@ -106,12 +106,12 @@ (action (name "air-backflip-right") - (hitbox 16 14 32 64) - (images "air/hat/stand.png")) + (hitbox 16 37 32 32) + (images "air/hat/backflip.png")) (action (name "air-backflip-left") - (hitbox 16 14 32 64) + (hitbox 16 37 32 32) (mirror-action "air-backflip-right")) (action @@ -195,12 +195,12 @@ (action (name "earth-climbing-right") - (hitbox 16 14 32 64) + (hitbox 22 21 32 64) (images "earth/hardhat/stand.png")) (action (name "earth-climbing-left") - (hitbox 16 14 32 64) + (hitbox 22 21 32 64) (mirror-action "earth-climbing-right")) (action @@ -215,12 +215,12 @@ (action (name "earth-backflip-right") - (hitbox 16 14 32 64) - (images "earth/hardhat/stand.png")) + (hitbox 16 37 32 32) + (images "earth/hardhat/backflip.png")) (action (name "earth-backflip-left") - (hitbox 16 14 32 64) + (hitbox 16 37 32 32) (mirror-action "earth-backflip-right")) (action diff --git a/src/object/player.cpp b/src/object/player.cpp index 66f3a2e4f..414f43dd8 100644 --- a/src/object/player.cpp +++ b/src/object/player.cpp @@ -224,6 +224,8 @@ Player::init() backflipping = false; backflip_direction = 0; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); visible = true; ability_time = 0; stone = false; @@ -338,6 +340,8 @@ Player::trigger_sequence(std::string sequence_name) backflipping = false; backflip_direction = 0; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); GameSession::current()->start_sequence(sequence_name); } @@ -388,6 +392,11 @@ Player::update(float elapsed_time) 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)); + if (player_status->bonus == EARTH_BONUS || player_status->bonus == AIR_BONUS) { + powersprite->set_angle(sprite->get_angle()); + if (player_status->bonus == EARTH_BONUS) + lightsprite->set_angle(sprite->get_angle()); + } } // set fall mode... @@ -408,6 +417,8 @@ Player::update(float elapsed_time) backflipping = false; backflip_direction = 0; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); // if controls are currently deactivated, we take care of standing up ourselves if (deactivated) @@ -917,6 +928,8 @@ Player::handle_input() backflipping = false; backflip_direction = 0; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); } } @@ -1439,6 +1452,8 @@ Player::kill(bool completely) physic.set_velocity_x(0); sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); if(!completely && is_big()) { SoundManager::current()->play("sounds/hurt.wav"); @@ -1455,6 +1470,8 @@ Player::kill(bool completely) duck = false; backflipping = false; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); set_bonus(NO_BONUS, true); } else if(player_status->bonus == NO_BONUS) { safe_timer.start(TUX_SAFE_TIME); @@ -1515,6 +1532,8 @@ Player::move(const Vector& vector) duck = false; backflipping = false; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); last_ground_y = vector.y; if (climbing) stop_climbing(*climbing); @@ -1653,6 +1672,8 @@ Player::start_climbing(Climbable& climbable) backflipping = false; backflip_direction = 0; sprite->set_angle(0.0f); + powersprite->set_angle(0.0f); + lightsprite->set_angle(0.0f); } }