3 // SuperTux - BicyclePlatform
4 // Copyright (C) 2007 Christoph Sommer <christoph.sommer@2007.expires.deltadevelopment.de>
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 #ifndef __BICYCLE_PLATFORM_H__
21 #define __BICYCLE_PLATFORM_H__
26 #include "object/moving_sprite.hpp"
27 #include "object/path.hpp"
28 #include "object/path_walker.hpp"
31 * Used to construct a pair of bicycle platforms: If one is pushed down, the other one rises
33 class BicyclePlatform : public MovingSprite
36 BicyclePlatform(const lisp::Lisp& reader);
37 BicyclePlatform(BicyclePlatform* master);
38 virtual ~BicyclePlatform();
40 virtual HitResponse collision(GameObject& other, const CollisionHit& hit);
41 virtual void update(float elapsed_time);
44 BicyclePlatform* master; /**< pointer to BicyclePlatform that does movement calculation */
45 BicyclePlatform* slave; /**< pointer to BicyclePlatform that reacts to master platform's movement calculation */
46 Vector center; /**< pivot point */
47 float radius; /**< radius of circle */
48 float angle; /**< current angle */
49 float angular_speed; /**< angular speed in rad per second */
50 std::set<GameObject*> contacts; /**< objects that are currently pushing on the platform */
51 float momentum; /** angular momentum in rad per second per second*/