}
void
-Snail::activate()
+Snail::initialize()
{
- WalkingBadguy::activate();
+ WalkingBadguy::initialize();
be_normal();
}
if (state == STATE_NORMAL) return;
state = STATE_NORMAL;
- WalkingBadguy::activate();
+ WalkingBadguy::initialize();
}
void
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
sprite->set_fps(64);
- physic.vx = 0;
- physic.vy = 0;
+ physic.set_velocity_x(0);
+ physic.set_velocity_y(0);
flat_timer.start(4);
}
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
sprite->set_fps(64);
- physic.vx = 0;
- physic.vy = 0;
+ physic.set_velocity_x(0);
+ physic.set_velocity_y(0);
// start a timer to delay addition of upward movement until we are (hopefully) out from under the player
- kicked_delay_timer.start(0.05);
+ kicked_delay_timer.start(0.05f);
}
bool
case STATE_KICKED_DELAY:
if (kicked_delay_timer.check()) {
- physic.vx = (dir == LEFT ? -KICKSPEED : KICKSPEED);
- physic.vy = KICKSPEED_Y;
+ physic.set_velocity_x(dir == LEFT ? -KICKSPEED : KICKSPEED);
+ physic.set_velocity_y(KICKSPEED_Y);
state = STATE_KICKED;
}
BadGuy::active_update(elapsed_time);
break;
case STATE_KICKED:
- physic.vx = physic.vx * pow(0.99, elapsed_time/0.02);
- if (fabsf(physic.vx) < walk_speed) be_normal();
+ physic.set_velocity_x(physic.get_velocity_x() * pow(0.99, elapsed_time/0.02));
+ if (fabsf(physic.get_velocity_x()) < walk_speed) be_normal();
BadGuy::active_update(elapsed_time);
break;
break;
case STATE_FLAT:
if(hit.top || hit.bottom) {
- physic.vy = 0;
+ physic.set_velocity_y(0);
}
if(hit.left || hit.right) {
}
break;
case STATE_KICKED_DELAY:
if(hit.top || hit.bottom) {
- physic.vy = 0;
+ physic.set_velocity_y(0);
}
if(hit.left || hit.right) {
- physic.vy = 0;
+ physic.set_velocity_x(0);
}
break;
case STATE_KICKED:
if(hit.top || hit.bottom) {
- physic.vy = 0;
+ physic.set_velocity_y(0);
}
if(hit.left || hit.right) {
sound_manager->play("sounds/iceblock_bump.wav", get_pos());
dir = (dir == LEFT) ? RIGHT : LEFT;
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
- physic.vx = -physic.vx*0.75;
- if (fabsf(physic.vx) < walk_speed) be_normal();
+ physic.set_velocity_x(-physic.get_velocity_x()*0.75);
+ if (fabsf(physic.get_velocity_x()) < walk_speed) be_normal();
}
}
case STATE_KICKED:
case STATE_NORMAL:
- squishcount++;
- if(squishcount >= MAXSQUISHES) {
- kill_fall();
- return true;
+ {
+ Player* player = dynamic_cast<Player*>(&object);
+ squishcount++;
+ if ((squishcount >= MAXSQUISHES) || (player && player->does_buttjump)) {
+ kill_fall();
+ return true;
+ }
}
sound_manager->play("sounds/stomp.wav", get_pos());