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

#include <tb_entity_behavior_interface.h>

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

Public Member Functions

 MoveBehavior (Entity &entity, const tbMath::Vector2 &velocity)
 
virtual ~MoveBehavior (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 MoveBehavior is a behavior that will move an Entity at a constant rate and direction.

Note
This behavior never removes itself, so if used, the entity should contain logic to warp or kill itself.

Constructor & Destructor Documentation

TurtleBrains::Game::MoveBehavior::MoveBehavior ( Entity entity,
const tbMath::Vector2 velocity 
)
inline

Creates a MoveBehavior that will move by the rate and direction specified by the velocity vector.

Parameters
entityThe entity that will be controlled and moving during this behavior.
velocityThe direction and speed which the entity will be moving at, by default this speed is in pixels per second unless the projection or view matrix has changed.
Note
This behavior never removes itself, so if used, the entity should contain logic to warp or kill itself.
virtual TurtleBrains::Game::MoveBehavior::~MoveBehavior ( void  )
inlinevirtual

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

Member Function Documentation

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

Moves the entity by the velocity within the given fixed-time step.

Reimplemented from TurtleBrains::Game::EntityBehaviorInterface.