}
void
-MrIceBlock::activate()
+MrIceBlock::initialize()
{
- WalkingBadguy::activate();
+ WalkingBadguy::initialize();
set_state(ICESTATE_NORMAL);
}
if(hit.right && dir == RIGHT) {
dir = LEFT;
sound_manager->play("sounds/iceblock_bump.wav", get_pos());
- if(++squishcount >= MAXSQUISHES) { kill_fall(); break; }
physic.set_velocity_x(-KICKSPEED);
} else if(hit.left && dir == LEFT) {
dir = RIGHT;
sound_manager->play("sounds/iceblock_bump.wav", get_pos());
- if(++squishcount >= MAXSQUISHES) { kill_fall(); break; }
physic.set_velocity_x(KICKSPEED);
}
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
{
switch(ice_state) {
case ICESTATE_KICKED:
+ {
+ BadGuy* badguy = dynamic_cast<BadGuy*>(&object);
+ if (badguy) {
+ badguy->kill_fall();
+ break;
+ }
+ }
+
+ // fall through
case ICESTATE_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;
+ }
}
set_state(ICESTATE_FLAT);
break;
case ICESTATE_FLAT:
{
- MovingObject* movingobject = dynamic_cast<MovingObject*>(&object);
- if (movingobject && (movingobject->get_pos().x < get_pos().x)) {
- dir = RIGHT;
- } else {
- dir = LEFT;
- }
+ MovingObject* movingobject = dynamic_cast<MovingObject*>(&object);
+ if (movingobject && (movingobject->get_pos().x < get_pos().x)) {
+ dir = RIGHT;
+ } else {
+ dir = LEFT;
+ }
}
if (nokick_timer.check()) set_state(ICESTATE_KICKED);
break;
switch(state) {
case ICESTATE_NORMAL:
- WalkingBadguy::activate();
+ WalkingBadguy::initialize();
break;
case ICESTATE_FLAT:
if(dir == UP) {
this->dir = dir;
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
set_state(ICESTATE_GRABBED);
- set_group(COLGROUP_DISABLED);
+ set_colgroup_active(COLGROUP_DISABLED);
}
void
{
this->dir = dir;
set_state(dir == UP ? ICESTATE_FLAT : ICESTATE_KICKED);
- set_group(COLGROUP_MOVING);
+ set_colgroup_active(COLGROUP_MOVING);
}
bool