--- /dev/null
+(supertux-level
+ (version 2)
+ (name (_ "Unnamed"))
+ (author "wolfgang")
+ (sector
+ (name "main")
+ (gradient
+ (top_color 0.108017 0.7639008 0.8920441)
+ (bottom_color 0.9094849 0.5871124 0.1132812)
+ )
+ (tilemap
+ (z-pos -100)
+ (solid #f)
+ (speed 1)
+ (width 25)
+ (height 35)
+ (tiles 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0)
+ )
+ (camera
+ (mode "normal")
+ )
+ (mrbomb
+ (direction "auto")
+ (x 608)
+ (y 1024)
+ (sprite "images/creatures/mr_bomb/mr_bomb.sprite")
+ )
+ (spawnpoint
+ (name "main")
+ (x 128)
+ (y 992)
+ )
+ (trampoline
+ (x 352)
+ (y 1056)
+ (sprite "")
+ )
+ (trampoline
+ (x 320)
+ (y 1056)
+ (sprite "images/objects/trampoline/trampoline_red.sprite")
+ )
+ (trampoline
+ (x 288)
+ (y 1056)
+ (sprite "")
+ )
+ (trampoline
+ (x 256)
+ (y 1056)
+ (sprite "images/objects/trampoline/trampoline_red.sprite")
+ )
+ )
+)
--- /dev/null
+// $Id$
+//
+// SuperTux - Trampoline
+// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#include <config.h>
+
+#include "trampoline.hpp"
+#include "object_factory.hpp"
+#include "player.hpp"
+#include "audio/sound_manager.hpp"
+#include "sprite/sprite_manager.hpp"
+
+/* Trampoline will accelerate player by VY_FACTOR (or to VY_INITIAL if
+ * that's faster) if he jumps on it. Acceleration is capped at VY_MIN. */
+namespace{
+ static const std::string TRAMPOLINE_SOUND = "sounds/trampoline.wav";
+ static const float VY_MIN = -1000; //negative, upwards
+ static const float VY_FACTOR = -1.5;
+ static const float VY_INITIAL = -500;
+}
+
+Trampoline::Trampoline(const lisp::Lisp& lisp)
+ : MovingSprite(lisp, "images/objects/trampoline/trampoline.sprite" )
+{
+ sound_manager->preload( TRAMPOLINE_SOUND );
+ flags |= FLAG_PORTABLE;
+ physic.set_velocity_y(0);
+ physic.enable_gravity(true);
+ on_ground = false;
+
+ //Check if we need another sprite
+ if( !lisp.get( "sprite", sprite_name ) ){
+ return;
+ }
+ if( sprite_name == "" ){
+ sprite_name = "images/objects/trampoline/trampoline.sprite";
+ return;
+ }
+ //Replace sprite
+ sprite = sprite_manager->create( sprite_name );
+
+}
+
+void
+Trampoline::update( float elapsed_time ){
+ if( !on_ground ){
+ movement = physic.get_movement(elapsed_time);
+ }
+}
+
+HitResponse
+Trampoline::collision(GameObject& other, const CollisionHit& hit )
+{
+ Player* player = dynamic_cast<Player*> (&other);
+ if ( player ) {
+ float vy = player->physic.get_velocity_y();
+ //player is falling down on trampolin holding "jump"
+ if( hit.top && vy > 0 && player->get_controller()->hold( Controller::JUMP )){
+ vy *= VY_FACTOR;
+ if( vy < VY_MIN ){
+ vy = VY_MIN;
+ }
+ if( vy > VY_INITIAL ){
+ vy = VY_INITIAL;
+ }
+ player->physic.set_velocity_y( vy );
+ //printf("nachher velocity y = %f\n", player->physic.get_velocity_y());
+ sound_manager->play( TRAMPOLINE_SOUND );
+ return SOLID;
+ }
+ }
+
+ return SOLID; //TODO: Nobody should be able to walk through the trampoline.
+}
+
+void
+Trampoline::collision_solid( const CollisionHit& hit ){
+ if( hit.bottom ){
+ on_ground = true;
+ }
+}
+
+void
+Trampoline::grab( MovingObject&, const Vector& pos, Direction ){
+ movement = pos - get_pos();
+ set_group( COLGROUP_DISABLED );
+ on_ground = true;
+}
+
+void
+Trampoline::ungrab(MovingObject& , Direction ){
+ set_group( COLGROUP_MOVING );
+ on_ground = false;
+ physic.set_velocity_y(0);
+}
+
+
+IMPLEMENT_FACTORY(Trampoline, "trampoline");
--- /dev/null
+// $Id$
+//
+// SuperTux - Trampolin
+// Copyright (C) 2006 Wolfgang Becker <uafr@gmx.de>
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License
+// as published by the Free Software Foundation; either version 2
+// of the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+// GNU General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; if not, write to the Free Software
+// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+#ifndef SUPERTUX_TRAMPOLINE_H
+#define SUPERTUX_TRAMPOLINE_H
+
+#include "moving_sprite.hpp"
+#include "lisp/lisp.hpp"
+#include "object/portable.hpp"
+#include "physic.hpp"
+
+/**
+ * Jumping on a trampolin makes tux jump higher.
+ */
+class Trampoline : public MovingSprite,
+ public Portable
+
+{
+public:
+ Trampoline(const lisp::Lisp& reader);
+
+ HitResponse collision(GameObject& other, const CollisionHit& hit);
+ void collision_solid( const CollisionHit& hit );
+ void update( float elapsed_time );
+
+ void grab( MovingObject&, const Vector& pos, Direction );
+ void ungrab(MovingObject& , Direction );
+
+private:
+ Physic physic;
+ bool on_ground;
+};
+
+#endif
+