X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fmriceblock.cpp;h=b2555763b3274d1bc5b3d2e0da3381ba403c6c56;hb=249a05a552937aca73d54888d3c2ca6d6fec0080;hp=9c5ad78e2b52fe4fde3f00c2c2c558c35c1d279d;hpb=3510a03c0e807c7a0ddde3cdf07ba91bda9393c4;p=supertux.git diff --git a/src/badguy/mriceblock.cpp b/src/badguy/mriceblock.cpp index 9c5ad78e2..b2555763b 100644 --- a/src/badguy/mriceblock.cpp +++ b/src/badguy/mriceblock.cpp @@ -1,3 +1,23 @@ +// $Id$ +// +// SuperTux +// Copyright (C) 2005 Matthias Braun +// +// 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 #include "mriceblock.h" @@ -33,8 +53,8 @@ MrIceBlock::write(lisp::Writer& writer) { writer.start_list("mriceblock"); - writer.write_float("x", get_pos().x); - writer.write_float("y", get_pos().y); + writer.write_float("x", start_position.x); + writer.write_float("y", start_position.y); writer.end_list("mriceblock"); } @@ -51,7 +71,6 @@ void MrIceBlock::active_action(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"); @@ -86,8 +105,8 @@ MrIceBlock::collision_solid(GameObject& object, const CollisionHit& hit) 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_sound("ricochet", get_pos(), + Sector::current()->player->get_pos()); break; } case ICESTATE_FLAT: @@ -134,20 +153,17 @@ MrIceBlock::collision_squished(Player& player) } // flatten - SoundManager::get()->play_sound(IDToSound(SND_STOMP), get_pos(), - player.get_pos()); + sound_manager->play_sound("stomp", get_pos(), player.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_sound("kick", this, player.get_pos()); if(player.get_pos().x < get_pos().x) { dir = RIGHT; @@ -157,7 +173,6 @@ MrIceBlock::collision_squished(Player& player) 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; } @@ -165,3 +180,4 @@ MrIceBlock::collision_squished(Player& player) return true; } +IMPLEMENT_FACTORY(MrIceBlock, "mriceblock")