// 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 "platform.hpp"
+
+#include <iostream>
#include "video/drawing_context.hpp"
#include "resources.hpp"
#include "player.hpp"
flags |= FLAG_SOLID;
path = Path::GetByName(use_path);
+ if (path == NULL) {
+ std::cerr << "Warning: Path for moving platform not found! Make sure that the name is spelled correctly,\nand that the path is initialized before the platform in the level file!\n";
+ }
path_offset = bbox.p1 - path->GetStart();
}
delete sprite;
}
+//TODO: Squish Tux when standing between platform and solid tile/object
+// Improve collision handling
+// Move all MovingObjects lying on the platform instead of only the player
HitResponse
Platform::collision(GameObject& other, const CollisionHit& hit)
{
if(other.get_flags() & FLAG_SOLID) {
//Collision with a solid tile
//does nothing, because the movement vector isn't used at the moment
+ return ABORT_MOVE;
}
return FORCE_MOVE;
}
void
-Platform::update(float elapsed_time)
+Platform::update(float )
{
set_pos(path->GetPosition() + path_offset);
}