0
0
mirror of https://github.com/Nimac0/SDL_Minigame synced 2026-01-12 07:53:43 +00:00

Implemented suggested changes

This commit is contained in:
Benedikt Galbavy 2024-12-02 21:47:36 +01:00
parent 2483b75983
commit 6a0b5197f9
3 changed files with 9 additions and 10 deletions

View File

@ -1,6 +1,7 @@
#pragma once
#include <stdint.h>
#include <cstdint>
class Entity;
class Component

View File

@ -66,12 +66,12 @@ void SoundManager::playSound(GameInternal* game, std::string sound, bool canOver
if(Mix_VolumeChunk(game->assets->getSound(sound), volume) == -1)
{
std::cerr << "Error adjusting volume: " /*<< Mix_GetError()*/ << std::endl;
std::cerr << "Error adjusting volume: " << SDL_GetError() << std::endl;
}
if (Mix_PlayChannel(channel, game->assets->getSound(sound), loops) == -1)
{
std::cerr << "Error playing sound '" << sound << "': " /*<< Mix_GetError()*/ << std::endl;
std::cerr << "Error playing sound '" << sound << "': " << SDL_GetError() << std::endl;
}
}
@ -88,12 +88,12 @@ void SoundManager::playMusic(GameInternal* game, std::string music, int loops, i
if(Mix_VolumeMusic(volume) == -1)
{
std::cerr << "Error adjusting volume: " /*<< Mix_GetError()*/ << std::endl;
std::cerr << "Error adjusting volume: " << SDL_GetError() << std::endl;
}
if (Mix_PlayMusic(game->assets->getMusic(music), loops) == -1)
{
std::cerr << "Error playing music '" << music << "': " /*<< Mix_GetError()*/ << std::endl;
std::cerr << "Error playing music '" << music << "': " << SDL_GetError() << std::endl;
}
}

View File

@ -12,12 +12,10 @@ void StatEffectsComponent::update(uint_fast16_t diffTime)
{
for (int i = 0; i < MAX_STATS; i++)
{
if (this->buffs.at(i) <= 0) continue;
if (this->buffs.at(i) - diffTime <= 0)
{
this->buffs.at(i) -= diffTime;
if (this->buffs.at(i) <= 0) {
this->resetStatValue((Stats)i);
}
this->buffs.at(i) -= diffTime;
}
}
@ -32,7 +30,7 @@ void StatEffectsComponent::modifyStatValue(Stats stat, int modifier) //modifier
switch (stat)
{
case Stats::MOVEMENT_SPEED:
this->entity->getComponent<TransformComponent>().modifySpeed(modifier * 60);
this->entity->getComponent<TransformComponent>().modifySpeed(modifier);
break;
case Stats::ATTACK_SPEED:
// this->entity->getComponent<KeyboardController>().modifyAtkSpeed(modifier);