From: LMH Date: Sat, 8 Mar 2014 19:53:47 +0000 (-1000) Subject: Alternative approach to rotating egg powerup. X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=516867a2d6aaffff19edc111d5182be58735d5d4;p=supertux.git Alternative approach to rotating egg powerup. Instead of using successive images of the egg rotated at different angles, a single egg image is used and rotated dependent on horizontal displacement. This significantly reduces the number of images used, and also shortens the code a bit. --- diff --git a/data/images/powerups/egg/egg-0.png b/data/images/powerups/egg/egg-0.png deleted file mode 100644 index 6f63e35c6..000000000 Binary files a/data/images/powerups/egg/egg-0.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-1.png b/data/images/powerups/egg/egg-1.png deleted file mode 100644 index 863b78b81..000000000 Binary files a/data/images/powerups/egg/egg-1.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-10.png b/data/images/powerups/egg/egg-10.png deleted file mode 100644 index cb804d733..000000000 Binary files a/data/images/powerups/egg/egg-10.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-11.png b/data/images/powerups/egg/egg-11.png deleted file mode 100644 index 9e326b2d0..000000000 Binary files a/data/images/powerups/egg/egg-11.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-12.png b/data/images/powerups/egg/egg-12.png deleted file mode 100644 index 1ee1f18dd..000000000 Binary files a/data/images/powerups/egg/egg-12.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-13.png b/data/images/powerups/egg/egg-13.png deleted file mode 100644 index 2b5e0a53b..000000000 Binary files a/data/images/powerups/egg/egg-13.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-14.png b/data/images/powerups/egg/egg-14.png deleted file mode 100644 index 707fc97d0..000000000 Binary files a/data/images/powerups/egg/egg-14.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-15.png b/data/images/powerups/egg/egg-15.png deleted file mode 100644 index 37266c8b0..000000000 Binary files a/data/images/powerups/egg/egg-15.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-16.png b/data/images/powerups/egg/egg-16.png deleted file mode 100644 index 9e24d1c10..000000000 Binary files a/data/images/powerups/egg/egg-16.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-17.png b/data/images/powerups/egg/egg-17.png deleted file mode 100644 index a6193d40a..000000000 Binary files a/data/images/powerups/egg/egg-17.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-18.png b/data/images/powerups/egg/egg-18.png deleted file mode 100644 index e0641398b..000000000 Binary files a/data/images/powerups/egg/egg-18.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-19.png b/data/images/powerups/egg/egg-19.png deleted file mode 100644 index cd2e385a3..000000000 Binary files a/data/images/powerups/egg/egg-19.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-2.png b/data/images/powerups/egg/egg-2.png deleted file mode 100644 index ed6b220cf..000000000 Binary files a/data/images/powerups/egg/egg-2.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-3.png b/data/images/powerups/egg/egg-3.png deleted file mode 100644 index e0f4bbb02..000000000 Binary files a/data/images/powerups/egg/egg-3.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-4.png b/data/images/powerups/egg/egg-4.png deleted file mode 100644 index e041ad7cd..000000000 Binary files a/data/images/powerups/egg/egg-4.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-5.png b/data/images/powerups/egg/egg-5.png deleted file mode 100644 index 0fc79ce6e..000000000 Binary files a/data/images/powerups/egg/egg-5.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-6.png b/data/images/powerups/egg/egg-6.png deleted file mode 100644 index fd2bfb349..000000000 Binary files a/data/images/powerups/egg/egg-6.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-7.png b/data/images/powerups/egg/egg-7.png deleted file mode 100644 index d9426abcf..000000000 Binary files a/data/images/powerups/egg/egg-7.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-8.png b/data/images/powerups/egg/egg-8.png deleted file mode 100644 index 9a7fc19cf..000000000 Binary files a/data/images/powerups/egg/egg-8.png and /dev/null differ diff --git a/data/images/powerups/egg/egg-9.png b/data/images/powerups/egg/egg-9.png deleted file mode 100644 index ff38eafd1..000000000 Binary files a/data/images/powerups/egg/egg-9.png and /dev/null differ diff --git a/data/images/powerups/egg/egg.png b/data/images/powerups/egg/egg.png new file mode 100644 index 000000000..6f63e35c6 Binary files /dev/null and b/data/images/powerups/egg/egg.png differ diff --git a/data/images/powerups/egg/egg.sprite b/data/images/powerups/egg/egg.sprite index df9f2c194..d1eac26ea 100644 --- a/data/images/powerups/egg/egg.sprite +++ b/data/images/powerups/egg/egg.sprite @@ -1,31 +1,7 @@ (supertux-sprite (action - (name "right") - (images "egg-0.png" - "egg-1.png" - "egg-2.png" - "egg-3.png" - "egg-4.png" - "egg-5.png" - "egg-6.png" - "egg-7.png" - "egg-8.png" - "egg-9.png" - "egg-10.png" - "egg-11.png" - "egg-12.png" - "egg-13.png" - "egg-14.png" - "egg-16.png" - "egg-17.png" - "egg-18.png" - ) - (fps 20) - ) - (action - (name "left") - (mirror-action "right") - (fps 20) + (name "default") + (images "egg.png") ) ) diff --git a/src/object/growup.cpp b/src/object/growup.cpp index 1bc7fcc3b..e4c32b0e7 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -14,6 +14,8 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . +#include + #include "audio/sound_manager.hpp" #include "object/growup.hpp" #include "object/player.hpp" @@ -32,8 +34,6 @@ GrowUp::GrowUp(Direction direction) : //set light for glow effect lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); lightsprite->set_color(Color(0.2f, 0.2f, 0.0f)); - - sprite->set_action((direction == LEFT) ? "left" : "right"); } void @@ -44,6 +44,8 @@ GrowUp::update(float elapsed_time) void GrowUp::draw(DrawingContext& context){ + //Set Sprite rotation angle + sprite->set_angle(get_pos().x * 360.0f / (32.0f * M_PI)); //Draw the Sprite. MovingSprite::draw(context); //Draw the light when dark @@ -63,15 +65,8 @@ GrowUp::collision_solid(const CollisionHit& hit) physic.set_velocity_y(0); if(hit.bottom && physic.get_velocity_y() > 0) physic.set_velocity_y(0); - if(hit.left || hit.right) { + if(hit.left || hit.right) physic.set_velocity_x(-physic.get_velocity_x()); - if(hit.left) - sprite->set_action("right"); - else { - sprite->set_action("left"); - } - - } } HitResponse