4 // Copyright (C) 2000 Bill Kendrick <bill@newbreedsoftware.com>
5 // Copyright (C) 2004 Tobias Glaesser <tobi.web@gmx.de>
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License
9 // as published by the Free Software Foundation; either version 2
10 // of the License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 // GNU General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
22 #ifndef SUPERTUX_GAMEOBJS_H
23 #define SUPERTUX_GAMEOBJS_H
25 #include "special/base.h"
26 #include "video/surface.h"
27 #include "special/timer.h"
29 #include "math/physic.h"
30 #include "collision.h"
31 #include "special/game_object.h"
32 #include "special/moving_object.h"
33 #include "serializable.h"
34 #include "utils/lispwriter.h"
36 /* Bounciness of distros: */
46 class BouncyDistro : public GameObject
49 BouncyDistro(const Vector& pos);
50 virtual void action(float elapsed_time);
51 virtual void draw(DrawingContext& context);
58 extern Surface* img_distro[4];
60 #define BOUNCY_BRICK_MAX_OFFSET 8
61 #define BOUNCY_BRICK_SPEED 0.9
65 class BrokenBrick : public GameObject
68 BrokenBrick(Tile* tile, const Vector& pos, const Vector& movement);
70 virtual void action(float elapsed_time);
71 virtual void draw(DrawingContext& context);
80 class BouncyBrick : public GameObject
83 BouncyBrick(const Vector& pos);
84 virtual void action(float elapsed_time);
85 virtual void draw(DrawingContext& context);
94 class FloatingText : public GameObject
97 FloatingText(const Vector& pos, const std::string& text_);
98 FloatingText(const Vector& pos, int s); // use this for score, for instance
100 virtual void action(float elapsed_time);
101 virtual void draw(DrawingContext& context);
109 extern Sprite *img_trampoline;
111 class Trampoline : public MovingObject, public Serializable
114 Trampoline(LispReader& reader);
115 Trampoline(float x, float y);
117 virtual void write(LispWriter& writer);
118 virtual void action(float frame_ratio);
119 virtual void draw(DrawingContext& context);
121 virtual void collision(const MovingObject& other, int);
122 void collision(void *p_c_object, int c_object, CollisionType type);
125 enum { M_NORMAL, M_HELD } mode;
132 extern Sprite *img_flying_platform;
134 class FlyingPlatform : public MovingObject, public Serializable
137 FlyingPlatform(LispReader& reader);
138 FlyingPlatform(int x, int y);
140 virtual void write(LispWriter& writer);
141 virtual void action(float frame_ratio);
142 virtual void draw(DrawingContext& context);
144 virtual void collision(const MovingObject& other, int);
145 void collision(void *p_c_object, int c_object, CollisionType type);
147 float get_vel_x() { return vel_x; }
148 float get_vel_y() { return vel_y; }
151 enum { M_NORMAL, M_HELD } mode;
154 std::vector<int> pos_x;
155 std::vector<int> pos_y;
158 float vel_x, vel_y; // calculated based in the velocity
165 extern Sprite *img_smoke_cloud;
167 class SmokeCloud : public GameObject
170 SmokeCloud(const Vector& pos);
172 virtual void action(float elapsed_time);
173 virtual void draw(DrawingContext& context);
180 class Particles : public GameObject
183 Particles(const Vector& epicenter, const Vector& velocity, const Vector& acceleration, int number, Color color, int size, int life_time);
186 virtual void action(float elapsed_time);
187 virtual void draw(DrawingContext& context);
200 std::vector <Particle*> particles;
203 void load_object_gfx();
207 /* Local Variables: */