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
26 #include "screen/surface.h"
30 #include "collision.h"
31 #include "game_object.h"
32 #include "moving_object.h"
33 #include "serializable.h"
34 #include "lispwriter.h"
36 /* Bounciness of distros: */
44 class BouncyDistro : public GameObject
47 BouncyDistro(const Vector& pos);
48 virtual void action(float elapsed_time);
49 virtual void draw(DrawingContext& context);
56 extern Surface* img_distro[4];
58 #define BOUNCY_BRICK_MAX_OFFSET 8
59 #define BOUNCY_BRICK_SPEED 0.9
63 class BrokenBrick : public GameObject
66 BrokenBrick(Tile* tile, const Vector& pos, const Vector& movement);
68 virtual void action(float elapsed_time);
69 virtual void draw(DrawingContext& context);
78 class BouncyBrick : public GameObject
81 BouncyBrick(const Vector& pos);
82 virtual void action(float elapsed_time);
83 virtual void draw(DrawingContext& context);
92 class FloatingScore : public GameObject
95 FloatingScore(const Vector& pos, int s);
97 virtual void action(float elapsed_time);
98 virtual void draw(DrawingContext& context);
106 #define TRAMPOLINE_FRAMES 4
107 extern Sprite *img_trampoline[TRAMPOLINE_FRAMES];
109 class Trampoline : public MovingObject, public Serializable
112 Trampoline(LispReader& reader);
113 Trampoline(float x, float y);
115 virtual void write(LispWriter& writer);
116 virtual void action(float frame_ratio);
117 virtual void draw(DrawingContext& context);
119 virtual void collision(const MovingObject& other, int);
120 void collision(void *p_c_object, int c_object, CollisionType type);
123 enum { M_NORMAL, M_HELD } mode;
130 extern Sprite *img_flying_platform;
132 class FlyingPlatform : public MovingObject, public Serializable
135 FlyingPlatform(LispReader& reader);
136 FlyingPlatform(int x, int y);
138 virtual void write(LispWriter& writer);
139 virtual void action(float frame_ratio);
140 virtual void draw(DrawingContext& context);
142 virtual void collision(const MovingObject& other, int);
143 void collision(void *p_c_object, int c_object, CollisionType type);
145 float get_vel_x() { return vel_x; }
146 float get_vel_y() { return vel_y; }
149 enum { M_NORMAL, M_HELD } mode;
152 std::vector<int> pos_x;
153 std::vector<int> pos_y;
156 float vel_x, vel_y; // calculated based in the velocity
163 void load_object_gfx();
167 /* Local Variables: */