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
30 #include "collision.h"
31 #include "game_object.h"
34 enum ObjectType { OBJ_NONE, OBJ_BADGUY, OBJ_TRAMPOLINE };
44 ObjectData(ObjectData* pobject)
45 : x((int)pobject->x), y((int)pobject->y), type(pobject->type), type_specific(pobject->type_specific) {};
46 ObjectData(int x_, int y_, ObjectType type_, T type_specific_)
47 : x(x_), y(y_), type(type_), type_specific(type_specific_) {};
50 : x(0), y(0), type(OBJ_NONE), type_specific() {};
53 /* Bounciness of distros: */
57 class BouncyDistro : public _GameObject, public Drawable
60 BouncyDistro(DisplayManager& displaymanager, const Vector& pos);
61 virtual void action(float elapsed_time);
62 virtual void draw(ViewPort& viewport, int layer);
63 virtual std::string type() const
64 { return "BouncyDistro"; };
71 extern Surface* img_distro[4];
73 #define BOUNCY_BRICK_MAX_OFFSET 8
74 #define BOUNCY_BRICK_SPEED 0.9
78 class BrokenBrick : public _GameObject, public Drawable
81 BrokenBrick(DisplayManager& displaymanager, Tile* tile,
82 const Vector& pos, const Vector& movement);
84 virtual void action(float elapsed_time);
85 virtual void draw(ViewPort& viewport, int layer);
87 virtual std::string type() const
88 { return "BrokenBrick"; };
97 class BouncyBrick : public _GameObject, public Drawable
100 BouncyBrick(DisplayManager& displaymanager, const Vector& pos);
101 virtual void action(float elapsed_time);
102 virtual void draw(ViewPort& viewport, int layer);
104 virtual std::string type() const
105 { return "BouncyBrick"; };
114 class FloatingScore : public _GameObject, public Drawable
117 FloatingScore(DisplayManager& displaymanager, const Vector& pos, int s);
119 virtual void action(float elapsed_time);
120 virtual void draw(ViewPort& viewport, int layer);
121 virtual std::string type() const
122 { return "FloatingScore"; };
132 struct TrampolineData
137 class Trampoline : public GameObject
140 void init(float x, float y);
141 void action(double frame_ratio);
143 std::string type() { return "Trampoline"; };
145 Trampoline(ObjectData<TrampolineData> data)
147 power = data.type_specific.power;
149 init(data.x, data.y);
152 void collision(void *p_c_object, int c_object, CollisionType type);
155 enum { M_NORMAL, M_HELD } mode;
162 void load_object_gfx();
166 /* Local Variables: */