Skip to content

Commit

Permalink
Separated shading on egg from the rotating graphic to make the rollin…
Browse files Browse the repository at this point in the history
…g egg look more natural.
  • Loading branch information
LMH0013 committed Mar 9, 2014
1 parent b727f35 commit 2a51207
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 4 deletions.
Binary file added data/images/powerups/egg/egg-shade.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified data/images/powerups/egg/egg.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
12 changes: 8 additions & 4 deletions 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")
)
)

5 changes: 5 additions & 0 deletions src/object/growup.cpp
Expand Up @@ -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));
Expand All @@ -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){
Expand Down
1 change: 1 addition & 0 deletions src/object/growup.hpp
Expand Up @@ -35,6 +35,7 @@ class GrowUp : public MovingSprite
private:
Physic physic;
Color light;
SpritePtr shadesprite;
SpritePtr lightsprite;
};

Expand Down

0 comments on commit 2a51207

Please sign in to comment.