#ifndef SUPERTUX_GAMEOBJS_H
#define SUPERTUX_GAMEOBJS_H
-#include "type.h"
-#include "screen/surface.h"
+#include "video/surface.h"
#include "timer.h"
#include "scene.h"
-#include "physic.h"
+#include "math/physic.h"
#include "collision.h"
-#include "game_object.h"
-#include "moving_object.h"
+#include "special/game_object.h"
+#include "special/moving_object.h"
#include "serializable.h"
-#include "lispwriter.h"
+#include "utils/lispwriter.h"
/* Bounciness of distros: */
#define NO_BOUNCE 0
#define BOUNCE 1
-struct TileId;
+namespace SuperTux {
+class Sprite;
+}
-class BouncyDistro : public GameObject
+class BouncyCoin : public GameObject
{
public:
- BouncyDistro(const Vector& pos);
+ BouncyCoin(const Vector& pos);
+ ~BouncyCoin();
virtual void action(float elapsed_time);
virtual void draw(DrawingContext& context);
private:
+ Sprite* sprite;
Vector position;
- float ym;
+ Timer2 timer;
};
-extern Surface* img_distro[4];
-
-#define BOUNCY_BRICK_MAX_OFFSET 8
-#define BOUNCY_BRICK_SPEED 0.9
-
-class Tile;
-
class BrokenBrick : public GameObject
{
public:
- BrokenBrick(Tile* tile, const Vector& pos, const Vector& movement);
+ BrokenBrick(Sprite* sprite, const Vector& pos, const Vector& movement);
+ ~BrokenBrick();
virtual void action(float elapsed_time);
virtual void draw(DrawingContext& context);
private:
- Timer timer;
- Tile* tile;
+ Timer2 timer;
+ Sprite* sprite;
Vector position;
Vector movement;
};
-class BouncyBrick : public GameObject
+class FloatingText : public GameObject
{
public:
- BouncyBrick(const Vector& pos);
- virtual void action(float elapsed_time);
- virtual void draw(DrawingContext& context);
-
-private:
- Vector position;
- float offset;
- float offset_m;
- TileId& shape;
-};
-
-class FloatingScore : public GameObject
-{
-public:
- FloatingScore(const Vector& pos, int s);
+ FloatingText(const Vector& pos, const std::string& text_);
+ FloatingText(const Vector& pos, int s); // use this for score, for instance
virtual void action(float elapsed_time);
virtual void draw(DrawingContext& context);
private:
Vector position;
- char str[10];
- Timer timer;
+ std::string text;
+ Timer2 timer;
};
+#if 0
+extern Sprite *img_trampoline;
+
class Trampoline : public MovingObject, public Serializable
{
public:
Trampoline(LispReader& reader);
+ Trampoline(float x, float y);
virtual void write(LispWriter& writer);
virtual void action(float frame_ratio);
float power;
unsigned int frame;
};
+#endif
-class FlyingPlatform : public MovingObject, public Serializable
+extern Sprite *img_smoke_cloud;
+
+class SmokeCloud : public GameObject
{
public:
- FlyingPlatform(LispReader& reader);
-
- virtual void write(LispWriter& writer);
- virtual void action(float frame_ratio);
+ SmokeCloud(const Vector& pos);
+
+ virtual void action(float elapsed_time);
virtual void draw(DrawingContext& context);
- virtual void collision(const MovingObject& other, int);
- void collision(void *p_c_object, int c_object, CollisionType type);
-
- float get_vel_x() { return vel_x; }
- float get_vel_y() { return vel_y; }
-
- Physic physic;
- enum { M_NORMAL, M_HELD } mode;
-
- private:
- std::vector<int> pos_x;
- std::vector<int> pos_y;
- float velocity;
+private:
+ Timer2 timer;
+ Vector position;
+};
- float vel_x, vel_y; // calculated based in the velocity
+class Particles : public GameObject
+{
+public:
+ Particles(const Vector& epicenter, int min_angle, int max_angle,
+ const Vector& initial_velocity, const Vector& acceleration,
+ int number, Color color, int size, float life_time, int drawing_layer);
+ ~Particles();
+
+ virtual void action(float elapsed_time);
+ virtual void draw(DrawingContext& context);
- int point;
- bool move;
- unsigned int frame;
+private:
+ Vector accel;
+ Timer2 timer;
+ bool live_forever;
+
+ Color color;
+ float size;
+ int drawing_layer;
+
+ struct Particle {
+ Vector pos, vel;
+// float angle;
+ };
+ std::vector <Particle*> particles;
};
void load_object_gfx();
+void free_object_gfx();
#endif