00001 // SuperTux - Hurting Platform 00002 // Copyright (C) 2006 Christoph Sommer <christoph.sommer@2006.expires.deltadevelopment.de> 00003 // 00004 // This program is free software: you can redistribute it and/or modify 00005 // it under the terms of the GNU General Public License as published by 00006 // the Free Software Foundation, either version 3 of the License, or 00007 // (at your option) any later version. 00008 // 00009 // This program is distributed in the hope that it will be useful, 00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 // GNU General Public License for more details. 00013 // 00014 // You should have received a copy of the GNU General Public License 00015 // along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 00017 #include "object/hurting_platform.hpp" 00018 00019 #include "badguy/badguy.hpp" 00020 #include "object/player.hpp" 00021 #include "supertux/object_factory.hpp" 00022 00023 HurtingPlatform::HurtingPlatform(const Reader& reader) 00024 : Platform(reader) 00025 { 00026 set_group(COLGROUP_TOUCHABLE); 00027 } 00028 00029 HitResponse 00030 HurtingPlatform::collision(GameObject& other, const CollisionHit& ) 00031 { 00032 Player* player = dynamic_cast<Player*>(&other); 00033 if (player) { 00034 if(player->is_invincible()) { 00035 return ABORT_MOVE; 00036 } 00037 player->kill(false); 00038 } 00039 BadGuy* badguy = dynamic_cast<BadGuy*>(&other); 00040 if (badguy) { 00041 badguy->kill_fall(); 00042 } 00043 00044 return FORCE_MOVE; 00045 } 00046 00047 /* EOF */