Sprite action work for powerup hats: climbing, backflip.
authorLMH <lmh.0013@gmail.com>
Sun, 14 Dec 2014 14:57:18 +0000 (04:57 -1000)
committerLMH <lmh.0013@gmail.com>
Sun, 14 Dec 2014 15:01:55 +0000 (05:01 -1000)
Still need to finish sprite actions for duck and skid.  Note that climbing action for Tux really needs some work in general.

data/images/creatures/tux/air/hat/backflip.png [new file with mode: 0644]
data/images/creatures/tux/earth/hardhat/backflip.png [new file with mode: 0644]
data/images/creatures/tux/earth/light/backflip.png [new file with mode: 0644]
data/images/creatures/tux/earth/light/duck.png [new file with mode: 0644]
data/images/creatures/tux/light.sprite
data/images/creatures/tux/powerups.sprite
src/object/player.cpp

diff --git a/data/images/creatures/tux/air/hat/backflip.png b/data/images/creatures/tux/air/hat/backflip.png
new file mode 100644 (file)
index 0000000..ac5c1e5
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 (file)
index 0000000..6016f23
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 (file)
index 0000000..b13a4c2
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 (file)
index 0000000..e8fd132
Binary files /dev/null and b/data/images/creatures/tux/earth/light/duck.png differ
index ea6edcd..2c08aff 100644 (file)
 
        (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")
 
        (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
index 2be5745..49d1b12 100644 (file)
 
        (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
 
        (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
 
        (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
 
        (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
index 66f3a2e..414f43d 100644 (file)
@@ -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);
   }
 }