From 59aca638da337e3c38405da23b024e7ad6d17270 Mon Sep 17 00:00:00 2001 From: Christoph Sommer Date: Sat, 13 May 2006 23:01:12 +0000 Subject: [PATCH] Created some code for Candle SVN-Revision: 3512 --- data/images/objects/candle/candle.sprite | 2 +- src/object/candle.cpp | 45 ++++++++++++++++++++++++++++++++ src/object/candle.hpp | 43 ++++++++++++++++++++++++++++++ 3 files changed, 89 insertions(+), 1 deletion(-) create mode 100644 src/object/candle.cpp create mode 100644 src/object/candle.hpp diff --git a/data/images/objects/candle/candle.sprite b/data/images/objects/candle/candle.sprite index 987c55333..1234648b9 100644 --- a/data/images/objects/candle/candle.sprite +++ b/data/images/objects/candle/candle.sprite @@ -2,10 +2,10 @@ (action (name "default") (images - "candle-0.png" "candle-1.png" "candle-2.png" "candle-3.png" + "candle-4.png" ) ) ) diff --git a/src/object/candle.cpp b/src/object/candle.cpp new file mode 100644 index 000000000..03bdd8d94 --- /dev/null +++ b/src/object/candle.cpp @@ -0,0 +1,45 @@ +// $Id$ +// +// SuperTux +// 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 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 "candle.hpp" +#include "object_factory.hpp" + +Candle::Candle(const lisp::Lisp& lisp) + : MovingSprite(lisp, "images/objects/candle/candle.sprite", LAYER_BACKGROUNDTILES+1, COLGROUP_DISABLED) +{ +} + +void +Candle::write(lisp::Writer& writer) +{ + writer.start_list("candle"); + writer.write_float("x", bbox.p1.x); + writer.write_float("y", bbox.p1.y); + writer.end_list("candle"); +} + +HitResponse +Candle::collision(GameObject& , const CollisionHit& ) +{ + return FORCE_MOVE; +} + +IMPLEMENT_FACTORY(Candle, "candle"); diff --git a/src/object/candle.hpp b/src/object/candle.hpp new file mode 100644 index 000000000..dd5864767 --- /dev/null +++ b/src/object/candle.hpp @@ -0,0 +1,43 @@ +// $Id$ +// +// SuperTux +// 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 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. + +#ifndef __CANDLE_H__ +#define __CANDLE_H__ + +#include "lisp/lisp.hpp" +#include "object/moving_sprite.hpp" +#include "serializable.hpp" + +/** + * A burning candle: Simple level decoration. + */ +class Candle : public MovingSprite, public Serializable +{ +public: + Candle(const lisp::Lisp& lisp); + virtual Candle* clone() const { return new Candle(*this); } + + void write(lisp::Writer& writer); + HitResponse collision(GameObject& other, const CollisionHit& hit); + +private: +}; + +#endif + -- 2.11.0