X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fbadguy%2Fsnail.hpp;h=cd62a1ec87572fe9e70aef9c11bc17682972b91d;hb=1980142d4600d3834e774d410798b47358aa555a;hp=45904e9bed6d7676f4d19fc5fa7842b069ec8d31;hpb=78e9b27b7059c9b9b16a7f871ab71f751ec75323;p=supertux.git diff --git a/src/badguy/snail.hpp b/src/badguy/snail.hpp index 45904e9be..cd62a1ec8 100644 --- a/src/badguy/snail.hpp +++ b/src/badguy/snail.hpp @@ -1,12 +1,10 @@ -// $Id$ -// // SuperTux - Badguy "Snail" // Copyright (C) 2006 Christoph Sommer // -// 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 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 3 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 @@ -14,34 +12,34 @@ // 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. +// along with this program. If not, see . -#ifndef __SNAIL_H__ -#define __SNAIL_H__ +#ifndef HEADER_SUPERTUX_BADGUY_SNAIL_HPP +#define HEADER_SUPERTUX_BADGUY_SNAIL_HPP -#include "badguy.hpp" +#include "badguy/walking_badguy.hpp" /** * Badguy "Snail" - a snail-like creature that can be flipped and tossed around at an angle */ -class Snail : public BadGuy +class Snail : public WalkingBadguy { public: - Snail(const lisp::Lisp& reader); + Snail(const Reader& reader); Snail(const Vector& pos, Direction d); - void activate(); - void write(lisp::Writer& writer); - HitResponse collision_solid(GameObject& object, const CollisionHit& hit); + void initialize(); + void collision_solid(const CollisionHit& hit); HitResponse collision_badguy(BadGuy& badguy, const CollisionHit& hit); + HitResponse collision_player(Player& player, const CollisionHit& hit); + bool can_break(); void active_update(float elapsed_time); - virtual Snail* clone() const { return new Snail(*this); } + bool is_freezable() const; protected: - bool collision_squished(Player& player); + bool collision_squished(GameObject& object); void be_normal(); /**< switch to state STATE_NORMAL */ void be_flat(); /**< switch to state STATE_FLAT */ void be_kicked(); /**< switch to state STATE_KICKED_DELAY */ @@ -53,13 +51,13 @@ private: STATE_KICKED_DELAY, /**< short delay before being launched */ STATE_KICKED /**< launched */ }; + +private: State state; - Timer flat_timer; /**< wait time until flipping right-side-up again */ Timer kicked_delay_timer; /**< wait time until switching from STATE_KICKED_DELAY to STATE_KICKED */ - int squishcount; - bool set_direction; - Direction initial_direction; + int squishcount; }; #endif +/* EOF */