+Sprite *img_flying_platform;
+
+FlyingPlatform::FlyingPlatform(LispReader& reader)
+{
+ reader.read_int_vector("x", pos_x);
+ reader.read_int_vector("y", pos_y);
+
+ velocity = 2.0;
+ reader.read_float("velocity", velocity);
+
+ base.x = pos_x[0];
+ base.y = pos_y[0];
+ base.width = 96;
+ base.height = 40;
+
+ point = 0;
+ move = false;
+
+ float x = pos_x[point+1] - pos_x[point];
+ float y = pos_y[point+1] - pos_y[point];
+ vel_x = x*velocity / sqrt(x*x + y*y);
+ vel_y = -(velocity - vel_x);
+
+ frame = 0;
+}
+
+FlyingPlatform::FlyingPlatform(int x, int y)
+{
+base.x = x;
+base.y = y;
+point = 0;
+move = false;
+}
+
+void
+FlyingPlatform::write(LispWriter& writer)
+{
+ writer.start_list("flying-trampoline");
+
+ writer.write_int_vector("x", pos_x);
+ writer.write_int_vector("y", pos_y);
+ writer.write_float("velocity", velocity);
+
+ writer.end_list("flying-trampoline");
+}
+
+void
+FlyingPlatform::draw(DrawingContext& context)
+{
+ img_flying_platform->draw(context, base, LAYER_OBJECTS);
+}
+
+void
+FlyingPlatform::action(float frame_ratio)
+{
+ // TODO: Remove if we're too far off the screen
+
+if(!move)
+ return;
+
+if((unsigned)point+1 != pos_x.size())
+ {
+ if(((pos_x[point+1] > pos_x[point] && base.x >= pos_x[point+1]) ||
+ (pos_x[point+1] < pos_x[point] && base.x <= pos_x[point+1]) ||
+ pos_x[point] == pos_x[point+1]) &&
+ ((pos_y[point+1] > pos_y[point] && base.y >= pos_y[point+1]) ||
+ (pos_y[point+1] < pos_y[point] && base.y <= pos_y[point+1]) ||
+ pos_y[point] == pos_y[point+1]))
+ {
+ point++;
+
+ float x = pos_x[point+1] - pos_x[point];
+ float y = pos_y[point+1] - pos_y[point];
+ vel_x = x*velocity / sqrt(x*x + y*y);
+ vel_y = -(velocity - vel_x);