Skip to content

Commit

Permalink
Only rotate egg when its actually moving (velocity <> 0)
Browse files Browse the repository at this point in the history
  • Loading branch information
tobbi committed Aug 1, 2014
1 parent f7fc7eb commit 5c8bc80
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/object/growup.cpp
Expand Up @@ -46,9 +46,12 @@ 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));
GrowUp::draw(DrawingContext& context)
{
if(physic.get_velocity_x() != 0) {
//Set Sprite rotation angle
sprite->set_angle(get_pos().x * 360.0f / (32.0f * M_PI));
}
//Draw the Sprite.
MovingSprite::draw(context);
//Draw shade
Expand Down Expand Up @@ -79,7 +82,7 @@ GrowUp::collision(GameObject& other, const CollisionHit& hit )
{
Player* player = dynamic_cast<Player*>(&other);
if(player != 0) {
if(!player->add_bonus(GROWUP_BONUS, true)){
if(!player->add_bonus(GROWUP_BONUS, true)) {
// Tux can't grow right now.
collision_solid( hit );
return ABORT_MOVE;
Expand Down

0 comments on commit 5c8bc80

Please sign in to comment.