Definition: Animation.h:17
Vector getPosition() const
Get position of Object.
int setAltitude(int new_altitude)
Set altitude of Object, with checks for range [0, MAX_ALTITUDE].
int getAltitude() const
Return altitude of Object.
virtual int deserialize(std::string s)
Deserialize string to become attributes and apply.
int m_altitude
0 to MAX_ALTITUDE (higher drawn on top).
Definition: Object.h:74
void setType(std::string new_type)
Set type identifier of Object.
void setFollowPath(bool new_follow_path=true)
Set follow_path (note: is also set in pathTo() method).
void doPathFollowing()
If following a path, update path progress.
void setSpeed(float speed)
Set speed of Object.
std::string m_type
Game programmer defined type.
Definition: Object.h:66
void setDirection(Vector new_direction)
Set direction of Object.
int setVisible(bool new_visible=true)
Set visibility of Object.
int setSprite(std::string sprite_label)
Set Sprite for this Object to animate.
Vector m_direction
Direction vector.
Definition: Object.h:71
bool m_avoid_collisions
True if should avoid collisions with HARD.
Definition: Object.h:85
int unregisterInterest(std::string event_type)
Unregister for interest in event.
std::string getType() const
Get type identifier of Object.
void setBox(Box new_box)
Set bounding box of Object.
bool isActive() const
Return activeness of Object.
Vector m_acceleration
Acceleration vector.
Definition: Object.h:73
Shape getShape() const
Get drawing shape.
void accelerate()
Add acceleration to Object velocity.
Vector getDirection() const
Get direction of Object.
static int max_id
Monotonically increasing identifier.
Definition: Object.h:62
void setVelocity(Vector velocity)
Set direction and speed of Object.
bool getFollowPath() const
Returns true if following a path (note: is set in pathTo() method).
float m_speed
Object speed in direction.
Definition: Object.h:72
virtual int draw()
Draw Object: Animation and/or Shape.
void setPath(Path new_path)
Set Path (note: is also set in pathTo() method).
bool isSolid() const
Return True if Object is HARD or SOFT, else false.
int setActive(bool new_active=true)
Set activeness of Object.
Solidness m_solidness
Solidness state of Object.
Definition: Object.h:75
Object()
Construct Object.
Animation m_animation
Animation associated with Object.
Definition: Object.h:76
bool m_follow_path
True if following path.
Definition: Object.h:84
void moveTo(Vector new_position)
Set direction of Object towards position.
void setAvoidCollisions(bool new_avoid_collisions=true)
Set "avoid collisions" (true - avoid collisions with HARD when moving).
Shape m_shape
Basic geometric shape to draw.
Definition: Object.h:81
virtual ~Object()
Destroy Object.
bool getAvoidCollisions() const
Get "avoid collisions" (true - avoid collisions with HARD when moving).
int m_id
Unique game engine defined identifier.
Definition: Object.h:65
std::string m_event_name[MAX_OBJ_EVENTS]
Names of events interested in.
Definition: Object.h:79
bool m_is_active
If false, Object not acted upon.
Definition: Object.h:67
PathFind * getPathFind()
Get object doing pathfinding.
virtual bool isModified() const
Return true if any attribute modified since last serialize.
int getId() const
Get Object id.
virtual bool isModified(enum ObjectAttribute attribute) const
Return true if attribute modified since last serialize.
float getSpeed() const
Get speed of Object.
void pathTo(Vector position)
Navigate Object from current position to target position using pathfinding.
Animation getAnimation() const
Get Animation for this Object.
Vector getVelocity() const
Get velocity of Object based on direction and speed.
bool getNoSoft() const
Get "no soft" setting of Object (true - cannot move onto SOFT Objects).
Path getPath() const
Get Path (note: is set in pathTo() method).
Solidness getSolidness() const
Return solidness of Object.
virtual int setPosition(Vector new_position)
Set position of Object.
Path m_path
If following path, holds path information.
Definition: Object.h:83
void setNoSoft(bool new_no_soft=true)
Set "no soft" setting of Object (true - cannot move onto SOFT Objects).
void setAnimation(Animation new_animation, bool set_box=true)
Set Animation for this Object to new one.
virtual std::string serialize(std::string attr="")
Serialize attributes to string.
bool isVisible() const
Return visibility of Object. Objects not visible are not drawn.
bool m_no_soft
True if won't move on SOFT Objects.
Definition: Object.h:77
bool m_is_visible
If true, Object gets drawn.
Definition: Object.h:68
virtual int eventHandler(const Event *p_event)
Handle event (default only handles pathfinding).
void pathTo(Object *p_o_target)
Navigate Object from current position to current position of target Object using pathfinding.
int registerInterest(std::string event_type)
Register for interest in event.
std::string toString() const
Return base attributes as string.
void setShape(Shape new_shape)
Set drawing shape.
PathFind * m_p_path_find
Object performing pathfinding.
Definition: Object.h:82
Vector m_position
Position in game world.
Definition: Object.h:70
Vector getAcceleration() const
Get acceleration of Object.
bool m_modified[ATTR_COUNT]
Mod. attrib. since last serialize().
Definition: Object.h:80
Box getBox() const
Get bounding box of Object.
int m_event_count
Number of events of interest.
Definition: Object.h:78
int setSolidness(Solidness new_solid)
Set solidness of Object, with checks for consistency.
void setId(int new_id)
Set Object id.
void setAcceleration(Vector new_acceleration)
Set acceleration of Object.
Vector predictPosition()
Predict Object position based on speed and direction.
Box m_box
Box for sprite boundary & collisions.
Definition: Object.h:69
Definition: PathFind.h:31
An animation for a sprite.
Definition: Animation.h:15
ObjectAttribute
Categories of attributes that indicate modification.
Definition: Object.h:36
const int MAX_OBJ_EVENTS
Max number of events Object can be interested in.
Definition: Object.h:23
Solidness
Types of solidness of Object.
Definition: Object.h:26
@ SOFT
Object causes collision, but doesn't impede.
Definition: Object.h:28
@ HARD
Object causes collisions and impedes.
Definition: Object.h:27
@ SPECTRAL
Object doesn't cause collisions.
Definition: Object.h:29
const int ATTR_COUNT
Count of number of modified attribute categories.
Definition: Object.h:33