sound_manager->preload("sounds/jump.wav");
sound_manager->preload("sounds/hurt.wav");
sound_manager->preload("sounds/skid.wav");
+ sound_manager->preload("sounds/flip.wav");
+ sound_manager->preload("sounds/invincible.wav");
init();
}
}
on_ground_flag = false;
+
+ // when invincible, spawn particles
+ if (invincible_timer.started() && !dying)
+ {
+ if (systemRandom.rand(0, 2) == 0) {
+ float px = systemRandom.randf(bbox.p1.x+0, bbox.p2.x-0);
+ float py = systemRandom.randf(bbox.p1.y+0, bbox.p2.y-0);
+ Vector ppos = Vector(px, py);
+ Vector pspeed = Vector(0, 0);
+ Vector paccel = Vector(0, 0);
+ // draw bright sparkle when there is lots of time left, dark sparkle when invincibility is about to end
+ if (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING) {
+ // make every other a longer sparkle to make trail a bit fuzzy
+ if (size_t(game_time*20)%2) {
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "small", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5));
+ } else {
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "medium", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5));
+ }
+ } else {
+ Sector::current()->add_object(new SpriteParticle("images/objects/particles/sparkle.sprite", "dark", ppos, ANCHOR_MIDDLE, pspeed, paccel, LAYER_OBJECTS+1+5));
+ }
+ }
+ }
+
}
bool
backflip_direction = (dir == LEFT)?(+1):(-1);
backflipping = true;
do_jump(-580);
+ sound_manager->play("sounds/flip.wav");
backflip_timer.start(0.15);
}
Player::set_visible(bool visible)
{
this->visible = visible;
+ if( visible )
+ set_group(COLGROUP_MOVING);
+ else
+ set_group(COLGROUP_DISABLED);
}
bool
else
tux_body->draw(context, get_pos(), layer);
- // Draw blinking star overlay
- if (invincible_timer.started() &&
- (invincible_timer.get_timeleft() > TUX_INVINCIBLE_TIME_WARNING
- || size_t(game_time*20)%2)
- && !dying)
- {
- if (!is_big() || duck)
- smalltux_star->draw(context, get_pos(), layer + 5);
- else
- bigtux_star->draw(context, get_pos(), layer + 5);
- }
}
void
if(dying || deactivated)
return;
- if(!completely && safe_timer.started() || invincible_timer.started())
+ if(!completely && (safe_timer.started() || invincible_timer.started()))
return;
sound_manager->play("sounds/hurt.wav");