Separated shading on egg from the rotating graphic to make the rolling egg look more...
authorLMH <lmh.0013@gmail.com>
Sun, 9 Mar 2014 02:46:09 +0000 (16:46 -1000)
committerLMH <lmh.0013@gmail.com>
Sun, 9 Mar 2014 02:46:09 +0000 (16:46 -1000)
data/images/powerups/egg/egg-shade.png [new file with mode: 0644]
data/images/powerups/egg/egg.png
data/images/powerups/egg/egg.sprite
src/object/growup.cpp
src/object/growup.hpp

diff --git a/data/images/powerups/egg/egg-shade.png b/data/images/powerups/egg/egg-shade.png
new file mode 100644 (file)
index 0000000..fcbb696
Binary files /dev/null and b/data/images/powerups/egg/egg-shade.png differ
index 6f63e35..8d6105f 100644 (file)
Binary files a/data/images/powerups/egg/egg.png and b/data/images/powerups/egg/egg.png differ
index d1eac26..0ad6b82 100644 (file)
@@ -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")
+  )
 )
 
index e4c32b0..4f832b9 100644 (file)
@@ -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){
index f1427c0..4b04823 100644 (file)
@@ -35,6 +35,7 @@ public:
 private:
   Physic physic;
   Color light;
+  SpritePtr shadesprite;
   SpritePtr lightsprite;
 };