Potato Engine
Loading...
Searching...
No Matches
Actor Class Reference

Base actor class. More...

#include <Actor.hpp>

Inheritance diagram for Actor:
Archivable Tickable Block Camera Entity Player

Public Member Functions

 Actor ()
 Constructs actor object.
Vector2 GetPosition () const
 Gets position.
void SetPosition (const Vector2 &position)
 Sets position.
Vector2 GetSize () const
 Gets size.
void SetSize (const Vector2 &size)
 Sets size.
float GetRotation () const
 Gets rotation.
void SetRotation (float rotation)
 Sets rotation.
void AddLocalOffset (const Vector2 &offset)
 Adds to location vector.
void AddLocalRotation (float rotation)
 Adds to rotation value.
bool isVisible () const
 Checks if actor visible.
void SetVisibility (bool visibility)
 Sets visibility of actor.
void DispatchBeginPlay ()
 Internal function used to queue BeginPlay() on actor.
Public Member Functions inherited from Tickable
bool isTicking () const
 Checks if object is ticking.
void SetTicking (bool isEnabled)
 Sets tick state for object.

Public Attributes

char Texture

Protected Member Functions

virtual void BeginPlay ()
 Gameplay start.
virtual void Tick (float dt) override
 Update tick event.

Detailed Description

Base actor class.

This class represents a level object that exists in the game world. All objects that obey world physics must inherit from Actor base

Definition at line 13 of file Actor.hpp.

Constructor & Destructor Documentation

◆ Actor()

Actor::Actor ( )

Constructs actor object.

Put all class level functionality here (member initializations, default values, etc.)

Warning
Never construct actors manually.
See also
World::SpawnActor

Definition at line 13 of file Actor.cpp.

◆ ~Actor()

Actor::~Actor ( )
virtual

Definition at line 82 of file Actor.cpp.

Member Function Documentation

◆ GetPosition()

Vector2 Actor::GetPosition ( ) const

Gets position.

Returns
Position

Definition at line 38 of file Actor.cpp.

◆ SetPosition()

void Actor::SetPosition ( const Vector2 & position)

Sets position.

Parameters
positionPosition to set

Definition at line 41 of file Actor.cpp.

◆ GetSize()

Vector2 Actor::GetSize ( ) const

Gets size.

Returns
Size

Definition at line 52 of file Actor.cpp.

◆ SetSize()

void Actor::SetSize ( const Vector2 & size)

Sets size.

Parameters
sizeSize to set

Definition at line 55 of file Actor.cpp.

◆ GetRotation()

float Actor::GetRotation ( ) const

Gets rotation.

Returns
rotation

Definition at line 60 of file Actor.cpp.

◆ SetRotation()

void Actor::SetRotation ( float rotation)

Sets rotation.

Parameters
rotationRotation to set (degrees)

Definition at line 63 of file Actor.cpp.

◆ AddLocalOffset()

void Actor::AddLocalOffset ( const Vector2 & offset)

Adds to location vector.

Parameters
offsetOffset to add

Definition at line 48 of file Actor.cpp.

◆ AddLocalRotation()

void Actor::AddLocalRotation ( float rotation)

Adds to rotation value.

Parameters
rotationRotation to add

Definition at line 70 of file Actor.cpp.

◆ isVisible()

bool Actor::isVisible ( ) const

Checks if actor visible.

Returns
true if visible

Definition at line 74 of file Actor.cpp.

◆ SetVisibility()

void Actor::SetVisibility ( bool visibility)

Sets visibility of actor.

Parameters
visibilityVisibility to set

Definition at line 77 of file Actor.cpp.

◆ DispatchBeginPlay()

void Actor::DispatchBeginPlay ( )

Internal function used to queue BeginPlay() on actor.

Definition at line 22 of file Actor.cpp.

◆ BeginPlay()

void Actor::BeginPlay ( )
protectedvirtual

Gameplay start.

Put all pre-gameplay functionality here

Note
Always call base method when overriding:
void ActorClass::BeginPlay() {
BaseActor::BeginPlay();
// ...
}

Reimplemented in Player.

Definition at line 29 of file Actor.cpp.

◆ Tick()

void Actor::Tick ( float dt)
overrideprotectedvirtual

Update tick event.

This function is called every tick on the update step. Put all gameplay functionality that should run every update here (custom movement logic, etc.)

Parameters
dtDeltatime; time elapsed since last frame in ms
Note
Always call base method when overriding:
void Class::Tick() {
BaseClass::Tick();
// ...
}

Reimplemented from Tickable.

Reimplemented in Player.

Definition at line 33 of file Actor.cpp.

Member Data Documentation

◆ Texture

char Actor::Texture

Definition at line 56 of file Actor.hpp.