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);
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();
}
}