: WalkingBadguy(reader, "images/creatures/mr_iceblock/mr_iceblock.sprite", "left", "right"), ice_state(ICESTATE_NORMAL), squishcount(0)
{
walk_speed = 80;
- max_drop_height = 600;
+ max_drop_height = 600;
sound_manager->preload("sounds/iceblock_bump.wav");
sound_manager->preload("sounds/stomp.wav");
sound_manager->preload("sounds/kick.wav");
MrIceBlock::MrIceBlock(const Vector& pos, Direction d)
: WalkingBadguy(pos, d, "images/creatures/mr_iceblock/mr_iceblock.sprite", "left", "right"), ice_state(ICESTATE_NORMAL), squishcount(0)
{
- walk_speed = 80;
- max_drop_height = 600;
+ walk_speed = 80;
+ max_drop_height = 600;
sound_manager->preload("sounds/iceblock_bump.wav");
sound_manager->preload("sounds/stomp.wav");
sound_manager->preload("sounds/kick.wav");
BadGuy::active_update(elapsed_time);
}
+bool
+MrIceBlock::can_break(){
+ return ice_state == ICESTATE_KICKED;
+}
+
void
MrIceBlock::collision_solid(const CollisionHit& hit)
{
WalkingBadguy::collision_solid(hit);
break;
case ICESTATE_KICKED: {
-#if 0
- // TODO move these into bonusblock class
- BonusBlock* bonusblock = dynamic_cast<BonusBlock*> (&object);
- if(bonusblock) {
- bonusblock->try_open();
- }
- Brick* brick = dynamic_cast<Brick*> (&object);
- if(brick) {
- brick->try_break();
- }
-#endif
if(hit.right && dir == RIGHT) {
dir = LEFT;
sound_manager->play("sounds/iceblock_bump.wav", get_pos());
return FORCE_MOVE;
}
}
-
+
return BadGuy::collision_player(player, hit);
}
{
if(ice_state == state)
return;
-
- if(state == ICESTATE_FLAT)
- flags |= FLAG_PORTABLE;
- else
- flags &= ~FLAG_PORTABLE;
switch(state) {
case ICESTATE_NORMAL:
case ICESTATE_FLAT:
sound_manager->play("sounds/stomp.wav", get_pos());
physic.set_velocity_x(0);
- physic.set_velocity_y(0);
-
+ physic.set_velocity_y(0);
+
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
flat_timer.start(4);
break;
set_group(COLGROUP_MOVING);
}
+bool
+MrIceBlock::is_portable() const
+{
+ return ice_state == ICESTATE_FLAT;
+}
+
IMPLEMENT_FACTORY(MrIceBlock, "mriceblock")