mirror of
https://github.com/Nimac0/SDL_Minigame
synced 2026-01-12 15:53:42 +00:00
powerups work + sprites for each powerup added
This commit is contained in:
parent
c49ce18ed0
commit
b814fa3298
BIN
assets/characterSelection.png
Normal file
BIN
assets/characterSelection.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 18 KiB |
@ -8,7 +8,7 @@ using Team = std::size_t;
|
|||||||
constexpr std::size_t MAX_COMPONENTS = 32;
|
constexpr std::size_t MAX_COMPONENTS = 32;
|
||||||
constexpr std::size_t MAX_GROUPS = 32;
|
constexpr std::size_t MAX_GROUPS = 32;
|
||||||
constexpr std::size_t MAX_STATS = 32;
|
constexpr std::size_t MAX_STATS = 32;
|
||||||
constexpr std::size_t MAX_TEAMS = 8; //
|
constexpr std::size_t MAX_TEAMS = 8;
|
||||||
|
|
||||||
constexpr int SCREEN_SIZE_HEIGHT = 640;
|
constexpr int SCREEN_SIZE_HEIGHT = 640;
|
||||||
constexpr int SCREEN_SIZE_WIDTH = 800;
|
constexpr int SCREEN_SIZE_WIDTH = 800;
|
||||||
@ -22,7 +22,7 @@ constexpr int MAP_SIZE_Y = 20;
|
|||||||
|
|
||||||
constexpr int SPAWN_ATTEMPTS = 30;
|
constexpr int SPAWN_ATTEMPTS = 30;
|
||||||
|
|
||||||
constexpr int BUFF_DURATION = 5000;
|
constexpr int BUFF_DURATION = 6000;
|
||||||
|
|
||||||
constexpr int BUFF_VALUE = 1;
|
constexpr int BUFF_VALUE = 1;
|
||||||
|
|
||||||
|
|||||||
@ -17,8 +17,8 @@ public:
|
|||||||
|
|
||||||
|
|
||||||
std::map<PowerupType, std::string> powerupDictionary = {
|
std::map<PowerupType, std::string> powerupDictionary = {
|
||||||
{PowerupType::HEART, "assets/heart.png"},
|
{PowerupType::HEART, "assets/heart_powerup.png"},
|
||||||
{PowerupType::WALKINGSPEED, "assets/heart.png"},
|
{PowerupType::WALKINGSPEED, "assets/movement_speed_powerup.png"},
|
||||||
{PowerupType::SHOOTINGSPEED, "assets/heart.png"}
|
{PowerupType::SHOOTINGSPEED, "assets/atk_speed_powerup.png"}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@ -75,6 +75,5 @@ void KeyboardController::update()
|
|||||||
|
|
||||||
void KeyboardController::modifyAtkSpeed(int8_t modifier)
|
void KeyboardController::modifyAtkSpeed(int8_t modifier)
|
||||||
{
|
{
|
||||||
this->fireCooldown -= modifier * 500;
|
this->fireCooldown -= modifier * 400;
|
||||||
std::cout << "curr fire cooldown: " << this->fireCooldown << std::endl;
|
|
||||||
}
|
}
|
||||||
@ -34,7 +34,6 @@ void PowerupComponent::update()
|
|||||||
{},
|
{},
|
||||||
true)) != nullptr)
|
true)) != nullptr)
|
||||||
{
|
{
|
||||||
std::cout << "collided with powerup" << std::endl;
|
|
||||||
(this->*pickupFunc)(player);
|
(this->*pickupFunc)(player);
|
||||||
this->entity->destroy();
|
this->entity->destroy();
|
||||||
}
|
}
|
||||||
@ -42,6 +41,7 @@ void PowerupComponent::update()
|
|||||||
|
|
||||||
void PowerupComponent::heartEffect(Entity* player)
|
void PowerupComponent::heartEffect(Entity* player)
|
||||||
{
|
{
|
||||||
|
if(player->getComponent<HealthComponent>().getHealth() < 5)
|
||||||
player->getComponent<HealthComponent>().modifyHealth(1);
|
player->getComponent<HealthComponent>().modifyHealth(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,18 +10,6 @@ void StatEffectsComponent::init()
|
|||||||
|
|
||||||
void StatEffectsComponent::update()
|
void StatEffectsComponent::update()
|
||||||
{
|
{
|
||||||
/*int i = 0;
|
|
||||||
std::transform(this->buffs.begin(), this->buffs.end(), this->buffs.begin(),
|
|
||||||
[this, &i](uint8_t statDuration) {
|
|
||||||
i++;
|
|
||||||
uint8_t newDur = statDuration - 1;
|
|
||||||
if (statDuration > 0 && newDur == 0) {
|
|
||||||
if (statDuration > 1)
|
|
||||||
std::cout << (int) statDuration << (int) newDur << std::endl;
|
|
||||||
this->modifyStatValue((Stats)i, BUFF_VALUE * -1);
|
|
||||||
}
|
|
||||||
return newDur;
|
|
||||||
});*/
|
|
||||||
for (int i = 0; i < MAX_STATS; i++)
|
for (int i = 0; i < MAX_STATS; i++)
|
||||||
{
|
{
|
||||||
if (this->buffs.at(i) == 0) continue;
|
if (this->buffs.at(i) == 0) continue;
|
||||||
@ -39,7 +27,7 @@ void StatEffectsComponent::modifyStatDur(Stats stat, uint8_t duration)
|
|||||||
this->buffs.at((uint8_t)stat) += duration;
|
this->buffs.at((uint8_t)stat) += duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
void StatEffectsComponent::modifyStatValue(Stats stat, int modifier)
|
void StatEffectsComponent::modifyStatValue(Stats stat, int modifier) //modifier is basically there so the modifyfuncs in the components know if stats should be increased or decreased
|
||||||
{
|
{
|
||||||
switch (stat)
|
switch (stat)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -81,5 +81,5 @@ void TransformComponent::update()
|
|||||||
|
|
||||||
void TransformComponent::modifySpeed(int8_t modifier)
|
void TransformComponent::modifySpeed(int8_t modifier)
|
||||||
{
|
{
|
||||||
this->speed += modifier * 2;
|
this->speed += modifier;
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user