#include "tile.h"
#include "gameloop.h"
#include "gameobjs.h"
+#include "sprite_manager.h"
+#include "resources.h"
void
BouncyDistro::init(float x, float y)
gold_text->draw(str, (int)base.x + 16 - strlen(str) * 8, (int)base.y, 1);
}
+/* Trampoline */
+
+#define TRAMPOLINE_FRAMES 4
+Sprite *img_trampoline[TRAMPOLINE_FRAMES];
+
+void load_trampoline_gfx()
+{
+ for (int i = 0; i < TRAMPOLINE_FRAMES; i++)
+ {
+ char sprite_name[16];
+ sprintf(sprite_name, "trampoline-%i", i+1);
+ img_trampoline[0] = sprite_manager->load(sprite_name);
+ }
+}
+
+void
+Trampoline::init(float x, float y)
+{
+ base.x = x;
+ base.y = y;
+}
+
+void
+Trampoline::action(double frame_ratio)
+{
+ (void) frame_ratio;
+ // TODO:
+ // If HELD
+ // - move with tux
+ // If jumped on
+ // - compress springs (reduce height)
+}
+
+void
+Trampoline::draw()
+{
+ img_trampoline[0]->draw((int)base.x, (int)base.y);
+}
+
+
/* EOF */
#include "timer.h"
#include "scene.h"
+template <class T>
+struct ObjectData
+{
+ int x;
+ int y;
+ T type_specific;
+
+ ObjectData(ObjectData* pobject)
+ : x((int)pobject->x), y((int)pobject->y) {};
+ ObjectData(int x_, int y_, T type_specific_)
+ : x(x_), y(y_), type_specific(type_specific_) {};
+
+ ObjectData()
+ : x(0), y(0), type_specific() {};
+};
+
+struct TrampolineData
+{
+ unsigned int power;
+};
+
+
/* Bounciness of distros: */
#define NO_BOUNCE 0
#define BOUNCE 1
std::string type() { return "FloatingScore"; };
};
+class Trampoline : public GameObject
+{
+ public:
+ void init(float x, float y);
+ void action(double frame_ratio);
+ void draw();
+ std::string type() { return "Trampoline"; };
+};
+
+void load_trampoline_gfx();
+
#endif
/* Local Variables: */
#include "lispreader.h"
#include "resources.h"
#include "music_manager.h"
+#include "gameobjs.h"
using namespace std;
while (!lisp_nil_p(cur))
{
lisp_object_t* data = lisp_car(cur);
+ std::string object_type = "";
- BadGuyData bg_data;
- bg_data.kind = badguykind_from_string(lisp_symbol(lisp_car(data)));
LispReader reader(lisp_cdr(data));
- reader.read_int("x", &bg_data.x);
- reader.read_int("y", &bg_data.y);
- reader.read_bool("stay-on-platform", &bg_data.stay_on_platform);
+ reader.read_string("type", &object_type);
- badguy_data.push_back(bg_data);
+ if (object_type == "badguy" || object_type == "")
+ {
+ BadGuyData bg_data;
+ bg_data.kind = badguykind_from_string(lisp_symbol(lisp_car(data)));
+ reader.read_int("x", &bg_data.x);
+ reader.read_int("y", &bg_data.y);
+ reader.read_bool("stay-on-platform", &bg_data.stay_on_platform);
+
+ badguy_data.push_back(bg_data);
+ }
+ else
+ {
+ if (lisp_symbol(lisp_car(data)) == "trampoline")
+ {
+ ObjectData<TrampolineData> _trampoline_data;
+ }
+ }
cur = lisp_cdr(cur);
}
#include "badguy.h"
#include "lispreader.h"
#include "musicref.h"
+#include "gameobjs.h"
class Tile;
float hor_autoscroll_speed;
std::vector<BadGuyData> badguy_data;
+ std::vector< ObjectData<TrampolineData> > trampoline_data;
/** A collection of points to which Tux can be reset after a lost live */
std::vector<ResetPoint> reset_points;
/* Upgrades: */
load_special_gfx();
+ /* Trampoline */
+ load_trampoline_gfx();
+
/* Distros: */
img_distro[0] = new Surface(datadir + "/images/tilesets/coin1.png",
USE_ALPHA);