Dragonfly 4.19
A text-based game engine
EventCollision.h
1///
2/// A "collision" event
3///
4
5#ifndef __EVENT_COLLISION_H__
6#define __EVENT_COLLISION_H__
7
8#include "Event.h"
9#include "Object.h"
10
11namespace df {
12
13const std::string COLLISION_EVENT = "df-collision";
14
15class EventCollision : public Event {
16
17 private:
18 Vector m_pos; ///< Where collision occurred.
19 Object *m_p_obj1; ///< Object moving, causing collision.
20 Object *m_p_obj2; ///< Object being collided with.
21
22 public:
23 /// Create collision event at (0,0) with o1 and o2 NULL.
25
26 /// Create collision event between o1 and o2 at position p.
27 /// Object o1 "caused" collision by moving into object o2.
29
30 /// Set object that caused collision.
31 void setObject1(Object *p_new_o1);
32
33 /// Return object that caused collision.
35
36 /// Set object that was collided with.
37 void setObject2(Object *p_new_o2);
38
39 /// Return object that was collided with.
41
42 /// Set position of collision.
43 void setPosition(Vector new_pos);
44
45 /// Return position of collision.
47};
48
49} // end of namespace df
50#endif // __EVENT_COLLISION_H__
Definition: EventCollision.h:15
Vector getPosition() const
Return position of collision.
Object * m_p_obj1
Object moving, causing collision.
Definition: EventCollision.h:19
Vector m_pos
Where collision occurred.
Definition: EventCollision.h:18
EventCollision(Object *p_o1, Object *p_o2, Vector p)
Create collision event between o1 and o2 at position p.
Object * getObject1() const
Return object that caused collision.
Object * getObject2() const
Return object that was collided with.
void setObject1(Object *p_new_o1)
Set object that caused collision.
EventCollision()
Create collision event at (0,0) with o1 and o2 NULL.
void setObject2(Object *p_new_o2)
Set object that was collided with.
void setPosition(Vector new_pos)
Set position of collision.
Object * m_p_obj2
Object being collided with.
Definition: EventCollision.h:20
Definition: Event.h:15
Definition: Object.h:59
Definition: Vector.h:12
An animation for a sprite.
Definition: Animation.h:15