static const float IDLE_TIME = 2.5f;
/** acceleration in horizontal direction when walking
- * (all acceleratiosn are in pixel/s^2) */
+ * (all accelerations are in pixel/s^2) */
static const float WALK_ACCELERATION_X = 300;
/** acceleration in horizontal direction when running */
static const float RUN_ACCELERATION_X = 400;
sound_manager->preload("sounds/hurt.wav");
sound_manager->preload("sounds/skid.wav");
sound_manager->preload("sounds/flip.wav");
- sound_manager->preload("sounds/invincible.wav");
+ sound_manager->preload("sounds/invincible_start.ogg");
sound_manager->preload("sounds/splash.ogg");
- sound_manager->preload("sounds/shoot.wav");
init();
}
dead = false;
dying = false;
- peeking = AUTO;
+ peekingX = AUTO;
+ peekingY = AUTO;
last_ground_y = 0;
fall_mode = ON_GROUND;
jumping = false;
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));
- }
+ // 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));
}
/* Peeking */
if( controller->released( Controller::PEEK_LEFT ) ) {
- peeking = AUTO;
+ peekingX = AUTO;
}
if( controller->released( Controller::PEEK_RIGHT ) ) {
- peeking = AUTO;
+ peekingX = AUTO;
}
- if( controller->released( Controller::UP ) ) {
- peeking = AUTO;
+ if( controller->released( Controller::PEEK_UP ) ) {
+ peekingY = AUTO;
}
- if( controller->released( Controller::DOWN ) ) {
- peeking = AUTO;
+ if( controller->released( Controller::PEEK_DOWN ) ) {
+ peekingY = AUTO;
}
if( controller->pressed( Controller::PEEK_LEFT ) ) {
- peeking = LEFT;
+ peekingX = LEFT;
}
if( controller->pressed( Controller::PEEK_RIGHT ) ) {
- peeking = RIGHT;
+ peekingX = RIGHT;
}
- if( controller->pressed( Controller::UP ) ) {
- peeking = UP;
- }
- if( controller->pressed( Controller::DOWN ) ) {
- peeking = DOWN;
+ if(!backflipping && !jumping && on_ground()) {
+ if( controller->pressed( Controller::PEEK_UP ) ) {
+ peekingY = UP;
+ } else if( controller->pressed( Controller::PEEK_DOWN ) ) {
+ peekingY = DOWN;
+ }
}
/* Handle horizontal movement: */
void
Player::make_invincible()
{
- sound_manager->play("sounds/invincible.wav");
+ sound_manager->play("sounds/invincible_start.ogg");
invincible_timer.start(TUX_INVINCIBLE_TIME);
Sector::current()->play_music(HERRING_MUSIC);
}