![]() |
Dragonfly 2.2
A text-based game engine
|
00001 /// 00002 /// A "collision" event 00003 /// 00004 00005 #ifndef __EVENT_COLLISION_H__ 00006 #define __EVENT_COLLISION_H__ 00007 00008 #include "Event.h" 00009 #include "GameObject.h" 00010 00011 #define COLLISION_EVENT "collision" 00012 00013 class EventCollision : public Event { 00014 00015 protected: 00016 Position pos; ///< Where collision occurred. 00017 GameObject *obj1; ///< The object moving, causing the collision. 00018 GameObject *obj2; ///< The object being collided with. 00019 00020 public: 00021 EventCollision(); 00022 00023 /// Create collision event between o1 and o2 at position p. 00024 /// Object o1 "caused" the collision by moving into object o2. 00025 EventCollision(GameObject *o1, GameObject *o2, Position p); 00026 00027 /// Return object that caused collision. 00028 GameObject *getObject1(); 00029 00030 /// Set object that caused collision. 00031 void setObject1(GameObject *new_o1); 00032 00033 /// Return object that was collided with. 00034 GameObject *getObject2(); 00035 00036 /// Set object that was collided with. 00037 void setObject2(GameObject *new_o2); 00038 00039 /// Return the position of the collision. 00040 Position getPosition(); 00041 00042 /// Set the position of the collision. 00043 void setPosition(Position new_pos); 00044 }; 00045 00046 #endif /// __EVENT_COLLISION_H__