+// $Id$
+//
+// SuperTux
+// Copyright (C) 2005 Matthias Braun <matze@braunis.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
+// 02111-1307, USA.
+
#include <config.h>
-#include "mriceblock.h"
-#include "object/block.h"
+#include "mriceblock.hpp"
+#include "object/block.hpp"
static const float WALKSPEED = 80;
static const float KICKSPEED = 500;
}
void
-MrIceBlock::active_action(float elapsed_time)
+MrIceBlock::active_update(float elapsed_time)
{
if(ice_state == ICESTATE_FLAT && flat_timer.check()) {
- printf("unflat.\n");
ice_state = ICESTATE_NORMAL;
physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
sprite->set_action(dir == LEFT ? "left" : "right");
}
- BadGuy::active_action(elapsed_time);
+ BadGuy::active_update(elapsed_time);
}
HitResponse
dir = dir == LEFT ? RIGHT : LEFT;
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
physic.set_velocity_x(-physic.get_velocity_x());
- SoundManager::get()->play_sound(IDToSound(SND_RICOCHET), get_pos(),
- Sector::current()->player->get_pos());
+ sound_manager->play("sounds/iceblock_bump.wav", get_pos());
break;
}
case ICESTATE_FLAT:
}
// flatten
- SoundManager::get()->play_sound(IDToSound(SND_STOMP), get_pos(),
- player.get_pos());
+ sound_manager->play("sounds/stomp.wav", get_pos());
physic.set_velocity_x(0);
physic.set_velocity_y(0);
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
flat_timer.start(4);
ice_state = ICESTATE_FLAT;
- printf("flat.\n");
break;
case ICESTATE_FLAT:
// kick
- SoundManager::get()->play_sound(IDToSound(SND_KICK), this,
- player.get_pos());
+ sound_manager->play("sounds/kick.wav", get_pos());
if(player.get_pos().x < get_pos().x) {
dir = RIGHT;
physic.set_velocity_x(dir == LEFT ? -KICKSPEED : KICKSPEED);
sprite->set_action(dir == LEFT ? "flat-left" : "flat-right");
ice_state = ICESTATE_KICKED;
- printf("kicked.\n");
break;
}
return true;
}
+IMPLEMENT_FACTORY(MrIceBlock, "mriceblock")