talking carrot + super arguments

This commit is contained in:
Crizomb 2025-06-15 22:07:00 +02:00
parent c8787846c3
commit 8b664a26ef
6 changed files with 98 additions and 7 deletions

View file

@ -20,7 +20,7 @@ sf::Texture bgTexture;
Game::Game()
: backGround(PLACE_HOLDER_TEXTURE),
carrot(ANGRY_PATHS, NEUTRAL_PATHS, HAPPY_PATHS) {
carrot(ANGRY_PATHS, NEUTRAL_PATHS, HAPPY_PATHS, mFont) {
assert(mFont.openFromFile("media/Sansation.ttf"));
mStatisticsText.setPosition({5.f, 5.f});
mStatisticsText.setCharacterSize(10);
@ -57,6 +57,10 @@ Game::Game()
carrot.setPosition(CARROT_POS);
carrot.setScale(sf::Vector2f(5, 5));
carrot.setTextPosition(CARROT_TEXT_POS);
carrot.setTextCharacterSize(30);
carrot.setTextFillColor(sf::Color::Black);
}
void generateTilePatternAndMusic(AudioEmitter &audio_emitter) {
@ -129,7 +133,10 @@ void Game::render() {
mWindow.draw(leftPressZone);
mWindow.draw(middlePressZone);
mWindow.draw(rightPressZone);
carrot.draw(mWindow, TimePerFrame.asSeconds());
carrot.handleText(mWindow, TimePerFrame.asSeconds());
if (!NoteTile::update(TimePerFrame.asSeconds(), mWindow))
update_scores(false);
mWindow.draw(mStatisticsText);
@ -158,9 +165,9 @@ void Game::update_scores(bool good_action) {
ScoreMultiplierText.setString(
std::format("ScoreMultiplier = {}", score_multiplier));
if (score_multiplier < 5) {
if (score_multiplier < 15) {
carrot.changeState(Angry);
} else if (score_multiplier < 10) {
} else if (score_multiplier < 35) {
carrot.changeState(Neutral);
} else {
carrot.changeState(Happy);