TurtleBrains  0.2.1
High quality, portable, C++ API for native application and game development.
TurtleBrains::Game::MoveToBehavior Class Reference

#include <tb_entity_behavior_interface.h>

Inheritance diagram for TurtleBrains::Game::MoveToBehavior:
TurtleBrains::Game::EntityBehaviorInterface TurtleBrains::Core::Noncopyable

Public Member Functions

 MoveToBehavior (Entity &entity, const tbMath::Vector2 &desiredPosition, float constantMoveSpeed)
 
virtual ~MoveToBehavior (void)
 
virtual void OnSimulate (void)
 
- Public Member Functions inherited from TurtleBrains::Game::EntityBehaviorInterface
 EntityBehaviorInterface (Entity &entity)
 
virtual ~EntityBehaviorInterface (void)=0
 

Additional Inherited Members

- Protected Member Functions inherited from TurtleBrains::Game::EntityBehaviorInterface
virtual void OnAdded (void)
 
virtual void OnRemoved (void)
 
virtual void OnPaused (void)
 
virtual void OnResume (void)
 
virtual void OnUpdate (const float deltaTime)
 
virtual void OnRender (void) const
 
virtual void OnCollideWith (const Entity &other)
 
- Protected Attributes inherited from TurtleBrains::Game::EntityBehaviorInterface
EntitymEntity
 

Detailed Description

The MoveToBehavior will move an Entity at a constant rate of speed towards a desiredPosition until they reach that location. The speed will not increase or decrease.

Constructor & Destructor Documentation

TurtleBrains::Game::MoveToBehavior::MoveToBehavior ( Entity entity,
const tbMath::Vector2 desiredPosition,
float  constantMoveSpeed 
)
inline

Creates a MoveToBehavior for the entity to move to a desired location, moving at the given speed.

Parameters
entityThe entity that will be controlled by the behavior and moved.
desiredPositionThe location the entity will travel toward, directly.
constantMoveSpeedThe speed at which the entity will move at during the behavior, without speeding up or slowing down.
virtual TurtleBrains::Game::MoveToBehavior::~MoveToBehavior ( void  )
inlinevirtual

Cleans up after the MoveToBehavior, which doesn't involve a whole lot.

Member Function Documentation

virtual void TurtleBrains::Game::MoveToBehavior::OnSimulate ( void  )
virtual

Moves the entity toward the desired position by the constant speed, if the entity would have passed on by the desired position it stops at the desired position and this behavior will get popped off the entity.

Reimplemented from TurtleBrains::Game::EntityBehaviorInterface.