return collision_solid(other, hit);
BadGuy* badguy = dynamic_cast<BadGuy*> (&other);
- if(badguy && badguy->state == STATE_ACTIVE)
+ if(badguy && badguy->state == STATE_ACTIVE && badguy->get_group() == COLGROUP_MOVING)
return collision_badguy(*badguy, hit);
Player* player = dynamic_cast<Player*> (&other);
// handle kicks from left or right side
if(ice_state == ICESTATE_FLAT && get_state() == STATE_ACTIVE) {
// hit from left side
- if(hit.normal.x > 0.7 &&
- !player.get_controller()->hold(Controller::ACTION)) {
+ if(hit.normal.x > 0.7) {
dir = RIGHT;
player.kick();
set_state(ICESTATE_KICKED);
return FORCE_MOVE;
- }
- else if(hit.normal.x < -0.7 &&
- !player.get_controller()->hold(Controller::ACTION)) {
+ } else if(hit.normal.x < -0.7) {
dir = LEFT;
player.kick();
set_state(ICESTATE_KICKED);
}
Player::Player(PlayerStatus* _player_status)
- : player_status(_player_status), grabbed_object(0)
+ : player_status(_player_status), grabbed_object(NULL)
{
controller = main_controller;
smalltux_gameover = sprite_manager->create("images/creatures/tux_small/smalltux-gameover.sprite");
visible = true;
on_ground_flag = false;
- grabbed_object = 0;
+ grabbed_object = NULL;
floor_normal = Vector(0,-1);
movement = physic.get_movement(elapsed_time);
- if(grabbed_object != 0 && !dying ) {
+ if(grabbed_object != NULL && !dying) {
Vector pos = get_pos() +
Vector(dir == LEFT ? -16 : 16,
bbox.get_height()*0.66666 - 32);
grabbed_object->grab(*this, pos, dir);
}
- if(grabbed_object != 0 && dying){
+ if(grabbed_object != NULL && dying){
grabbed_object->ungrab(*this, dir);
+ grabbed_object = NULL;
}
on_ground_flag = false;
log_debug << "Non MovingObjetc grabbed?!?" << std::endl;
}
grabbed_object->ungrab(*this, dir);
- grabbed_object = 0;
+ grabbed_object = NULL;
}
}
if(other.get_flags() & FLAG_PORTABLE) {
Portable* portable = dynamic_cast<Portable*> (&other);
- if(portable && grabbed_object == 0 && controller->hold(Controller::ACTION)
+ assert(portable != NULL);
+ if(portable && grabbed_object == NULL
+ && controller->hold(Controller::ACTION)
&& fabsf(hit.normal.x) > .9) {
grabbed_object = portable;
+ grabbed_object->grab(*this, get_pos(), dir);
return CONTINUE;
}
}