0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 21:23:41 +00:00

rework calculateType()

This commit is contained in:
ineslelin 2024-11-05 20:52:24 +01:00
parent c19171328d
commit 1cd604e1f0
2 changed files with 6 additions and 5 deletions

View File

@ -28,7 +28,7 @@ public:
void createPowerup(Vector2D pos, std::function<void (Entity*)> pickupFunc, std::string texturePath);
Vector2D calculateSpawnPosition();
PowerupType calculateType();
template <typename T> T calculateType(int amount);
//texture management
void addTexture(std::string id, const char* path);

View File

@ -98,8 +98,9 @@ Vector2D AssetManager::calculateSpawnPosition()
return spawnPos;
}
PowerupType AssetManager::calculateType()
template <typename T>
T AssetManager::calculateType(int amount)
{
PowerupType type = PowerupType(rand() % 3);
return type;
T type = T(rand() % amount);
return type;
}