From: LMH Date: Sun, 9 Mar 2014 02:46:09 +0000 (-1000) Subject: Separated shading on egg from the rotating graphic to make the rolling egg look more... X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=2a5120775535019c021f9053078368fe9acb5876;p=supertux.git Separated shading on egg from the rotating graphic to make the rolling egg look more natural. --- diff --git a/data/images/powerups/egg/egg-shade.png b/data/images/powerups/egg/egg-shade.png new file mode 100644 index 000000000..fcbb69653 Binary files /dev/null and b/data/images/powerups/egg/egg-shade.png differ diff --git a/data/images/powerups/egg/egg.png b/data/images/powerups/egg/egg.png index 6f63e35c6..8d6105ff9 100644 Binary files a/data/images/powerups/egg/egg.png 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 d1eac26ea..0ad6b8286 100644 --- a/data/images/powerups/egg/egg.sprite +++ b/data/images/powerups/egg/egg.sprite @@ -1,7 +1,11 @@ (supertux-sprite - (action - (name "default") - (images "egg.png") - ) + (action + (name "default") + (images "egg.png") + ) + (action + (name "shadow") + (images "egg-shade.png") + ) ) diff --git a/src/object/growup.cpp b/src/object/growup.cpp index e4c32b0e7..4f832b956 100644 --- a/src/object/growup.cpp +++ b/src/object/growup.cpp @@ -26,11 +26,14 @@ GrowUp::GrowUp(Direction direction) : MovingSprite(Vector(0,0), "images/powerups/egg/egg.sprite", LAYER_OBJECTS, COLGROUP_MOVING), physic(), light(0.0f,0.0f,0.0f), + shadesprite(sprite_manager->create("images/powerups/egg/egg.sprite")), lightsprite(sprite_manager->create("images/objects/lightmap_light/lightmap_light-small.sprite")) { physic.enable_gravity(true); physic.set_velocity_x((direction == LEFT)?-100:100); sound_manager->preload("sounds/grow.ogg"); + //shadow to remain in place as egg rolls + shadesprite->set_action("shadow"); //set light for glow effect lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE)); lightsprite->set_color(Color(0.2f, 0.2f, 0.0f)); @@ -48,6 +51,8 @@ GrowUp::draw(DrawingContext& context){ sprite->set_angle(get_pos().x * 360.0f / (32.0f * M_PI)); //Draw the Sprite. MovingSprite::draw(context); + //Draw shade + shadesprite->draw(context, get_pos(), layer+1); //Draw the light when dark context.get_light( get_bbox().get_middle(), &light ); if (light.red + light.green < 2.0){ diff --git a/src/object/growup.hpp b/src/object/growup.hpp index f1427c028..4b0482360 100644 --- a/src/object/growup.hpp +++ b/src/object/growup.hpp @@ -35,6 +35,7 @@ public: private: Physic physic; Color light; + SpritePtr shadesprite; SpritePtr lightsprite; };