Making the speed a float number

This commit is contained in:
Ulysse Cura 2024-10-17 19:11:54 +02:00
parent d7c3a55068
commit 49d3d1ceed
1 changed files with 3 additions and 3 deletions

View File

@ -22,7 +22,7 @@ struct TransformComponent : public Component {
position.zero();
}
TransformComponent(Vector2D<float> pos, Vector2D<int> dim, int sc, int spd) : position(pos), speed(spd), dimension(dim), scale(sc)
TransformComponent(Vector2D<float> pos, Vector2D<int> dim, int sc, float spd) : position(pos), speed(spd), dimension(dim), scale(sc)
{}
void init() override
@ -32,7 +32,7 @@ struct TransformComponent : public Component {
void update() override
{
position += (velocity * static_cast<float>(speed));
position += (velocity * speed);
entity->draw_priority = static_cast<int>(position.y + static_cast<float>(dimension.y * scale));
}
@ -40,7 +40,7 @@ struct TransformComponent : public Component {
Vector2D<float> position;
Vector2D<float> velocity;
int speed {1};
float speed {1};
Vector2D<int> dimension {32, 32};
int scale {1};