The transform component is responsible for the position, direction and size of an entity. It is used to move the entity in the game world and to determine its size and position on the screen.
More...
#include <TransformComponent.h>
|
| Vector2D | direction |
| | The direction in which the entity is moving. (0, 0) is the default and signifies no movement.
|
| |
The transform component is responsible for the position, direction and size of an entity. It is used to move the entity in the game world and to determine its size and position on the screen.
◆ TransformComponent() [1/3]
| TransformComponent::TransformComponent |
( |
float | scale = 1 | ) |
|
|
explicit |
- Attention
- in order to allow an entity to move the stat "speed" must be set in the DataComponent (written exactly like that and set to any positive int value, 0 will lead to no movement, negative numbers to backwards movement)
- Parameters
-
| scale | base value is 1 (32x32px), size gets multiplied with scale |
◆ TransformComponent() [2/3]
| TransformComponent::TransformComponent |
( |
float | x, |
|
|
float | y, |
|
|
float | scale = 1 ) |
- Parameters
-
| x | x coordinate of spawnposition |
| y | y coordinate of spawnposition |
| scale | base value is 1 (32x32px per default), size gets multiplied with scale |
◆ TransformComponent() [3/3]
| TransformComponent::TransformComponent |
( |
float | x, |
|
|
float | y, |
|
|
int | w, |
|
|
int | h, |
|
|
float | scale = 1 ) |
- Parameters
-
| x | x coordinate of spawnposition |
| y | y coordinate of spawnposition |
| w | add custom width |
| h | add custom height |
| scale | base value is 1 (32x32px per default), size gets multiplied with scale |
◆ direction
| Vector2D TransformComponent::direction |
The direction in which the entity is moving. (0, 0) is the default and signifies no movement.
access direction with direction.x and direction.y for each direction
x = 1 for right, -1 for left
y = 1 for down, -1 for up
The documentation for this class was generated from the following files: