Skip to content

Commit

Permalink
WIP improvement: Egg powerup rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi authored and Tobias Markus committed Jan 24, 2014
1 parent 951d08c commit 0bf0ca2
Show file tree
Hide file tree
Showing 22 changed files with 39 additions and 3 deletions.
File renamed without changes
Binary file added data/images/powerups/egg/egg-1.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-10.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-11.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-12.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-13.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-14.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-15.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-16.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-17.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-18.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-19.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-2.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-3.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-4.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-5.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-6.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-7.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-8.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/images/powerups/egg/egg-9.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 29 additions & 2 deletions data/images/powerups/egg/egg.sprite
@@ -1,4 +1,31 @@
(supertux-sprite
(action
(name "default")
(images "egg.png")))
(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 25)
)
(action
(name "left")
(mirror-action "right")
(fps 25)
)
)

11 changes: 10 additions & 1 deletion src/object/growup.cpp
Expand Up @@ -32,6 +32,8 @@ 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
Expand Down Expand Up @@ -61,8 +63,15 @@ 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
Expand Down

0 comments on commit 0bf0ca2

Please sign in to comment.