MrIceBlock::MrIceBlock(const lisp::Lisp& reader)
: BadGuy(reader, "images/creatures/mr_iceblock/mr_iceblock.sprite"), ice_state(ICESTATE_NORMAL), squishcount(0)
{
- reader.get("direction", direction);
- set_direction = false;
- if( direction != "auto" && direction != ""){
- set_direction = true;
- initial_direction = str2dir( direction );
- }
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)
- : BadGuy(pos, "images/creatures/mr_iceblock/mr_iceblock.sprite"), ice_state(ICESTATE_NORMAL), squishcount(0)
+ : BadGuy(pos, d, "images/creatures/mr_iceblock/mr_iceblock.sprite"), ice_state(ICESTATE_NORMAL), squishcount(0)
{
- set_direction = true;
- initial_direction = d;
sound_manager->preload("sounds/iceblock_bump.wav");
sound_manager->preload("sounds/stomp.wav");
sound_manager->preload("sounds/kick.wav");
{
writer.start_list("mriceblock");
- writer.write_string("direction", direction);
writer.write_float("x", start_position.x);
writer.write_float("y", start_position.y);
void
MrIceBlock::activate()
{
- if (set_direction) {
- dir = initial_direction;
- }
-
physic.set_velocity_x(dir == LEFT ? -WALKSPEED : WALKSPEED);
sprite->set_action(dir == LEFT ? "left" : "right");
set_state(ICESTATE_NORMAL);