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 FloatingScore : public GameObject
97 FloatingScore(const Vector& pos, int s);
99 virtual void action(float elapsed_time);
100 virtual void draw(DrawingContext& context);
108 extern Sprite *img_trampoline;
110 class Trampoline : public MovingObject, public Serializable
113 Trampoline(LispReader& reader);
114 Trampoline(float x, float y);
116 virtual void write(LispWriter& writer);
117 virtual void action(float frame_ratio);
118 virtual void draw(DrawingContext& context);
120 virtual void collision(const MovingObject& other, int);
121 void collision(void *p_c_object, int c_object, CollisionType type);
124 enum { M_NORMAL, M_HELD } mode;
131 extern Sprite *img_flying_platform;
133 class FlyingPlatform : public MovingObject, public Serializable
136 FlyingPlatform(LispReader& reader);
137 FlyingPlatform(int x, int y);
139 virtual void write(LispWriter& writer);
140 virtual void action(float frame_ratio);
141 virtual void draw(DrawingContext& context);
143 virtual void collision(const MovingObject& other, int);
144 void collision(void *p_c_object, int c_object, CollisionType type);
146 float get_vel_x() { return vel_x; }
147 float get_vel_y() { return vel_y; }
150 enum { M_NORMAL, M_HELD } mode;
153 std::vector<int> pos_x;
154 std::vector<int> pos_y;
157 float vel_x, vel_y; // calculated based in the velocity
164 extern Sprite *img_smoke_cloud;
166 class SmokeCloud : public GameObject
169 SmokeCloud(const Vector& pos);
171 virtual void action(float elapsed_time);
172 virtual void draw(DrawingContext& context);
179 void load_object_gfx();
183 /* Local Variables: */