-// $Id: moving_object.h 2295 2005-03-30 01:52:14Z matzebraun $
+// $Id$
//
-// SuperTux - A Jump'n Run
-// Copyright (C) 2004 Matthias Braun <matze@braunis.de
+// SuperTux
+// Copyright (C) 2006 Matthias Braun <matze@braunis.de>
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
#ifndef SUPERTUX_MOVING_OBJECT_H
#define SUPERTUX_MOVING_OBJECT_H
+#include <stdint.h>
+
#include "game_object.hpp"
#include "collision_hit.hpp"
#include "math/vector.hpp"
class Sector;
class CollisionGrid;
+enum CollisionGroup {
+ COLGROUP_DISABLED,
+ COLGROUP_MOVING,
+ // moving object but don't collide against other moving objects
+ COLGROUP_MOVING_ONLY_STATIC,
+ COLGROUP_STATIC,
+ COLGROUP_MOVINGSTATIC,
+ COLGROUP_TOUCHABLE,
+
+ COLGROUP_TILEMAP /* not really used at the moment */
+};
+
/**
* Base class for all dynamic/moving game objects. This class contains things
* for handling the bounding boxes and collision feedback.
*/
virtual HitResponse collision(GameObject& other,
const CollisionHit& hit) = 0;
+ /** called when tiles with special attributes have been touched */
+ virtual void collision_tile(uint32_t tile_attributes)
+ {
+ (void) tile_attributes;
+ }
const Vector& get_pos() const
{
{
bbox.set_pos(pos);
}
+
+ CollisionGroup get_group() const
+ {
+ return group;
+ }
+
+ void set_group(CollisionGroup group)
+ {
+ this->group = group;
+ }
protected:
friend class Sector;
/** The movement that will happen till next frame
*/
Vector movement;
+ /** The collision group */
+ CollisionGroup group;
+
+private:
+ // this is only here for internal collision detection use
+ Rect dest;
};
#endif