X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Fbadguy%2Fstalactite.cpp;h=33a1606462944111515ddcba59d47674867622e5;hb=7d24ccd38a1aa858e96b238027594d91081daaa1;hp=a058c186e11373b90f325276743cbe6c26bb6f37;hpb=02288dc76442bd6616a200a2d22c0954d2fc8180;p=supertux.git diff --git a/src/badguy/stalactite.cpp b/src/badguy/stalactite.cpp index a058c186e..33a160646 100644 --- a/src/badguy/stalactite.cpp +++ b/src/badguy/stalactite.cpp @@ -1,7 +1,7 @@ // $Id$ -// +// // SuperTux -// Copyright (C) 2005 Matthias Braun +// Copyright (C) 2006 Matthias Braun // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -12,27 +12,23 @@ // 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. +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include "stalactite.hpp" +#include "random_generator.hpp" static const int SHAKE_RANGE = 40; static const float SHAKE_TIME = .8; static const float SQUISH_TIME = 2; Stalactite::Stalactite(const lisp::Lisp& lisp) + : BadGuy(lisp, "images/creatures/stalactite/stalactite.sprite"), state(STALACTITE_HANGING) { - lisp.get("x", start_position.x); - lisp.get("y", start_position.y); - bbox.set_size(31.8, 31.8); - sprite = sprite_manager->create("images/creatures/stalactite/stalactite.sprite"); - state = STALACTITE_HANGING; countMe = false; } @@ -92,7 +88,7 @@ HitResponse Stalactite::collision_player(Player& player, const CollisionHit& ) { if(state != STALACTITE_SQUISHED) { - player.kill(Player::SHRINK); + player.kill(false); } return FORCE_MOVE; @@ -110,7 +106,7 @@ Stalactite::draw(DrawingContext& context) return; if(state == STALACTITE_SHAKING) { - sprite->draw(context, get_pos() + Vector((rand() % 6)-3, 0), LAYER_OBJECTS); + sprite->draw(context, get_pos() + Vector(systemRandom.rand(-3,3), 0), LAYER_OBJECTS); } else { sprite->draw(context, get_pos(), LAYER_OBJECTS); }