Derniers ajustements
This commit is contained in:
parent
33bda6381d
commit
d68f697e59
2 changed files with 17 additions and 10 deletions
|
@ -44,12 +44,16 @@ Game::Game()
|
||||||
middlePressZone.setFillColor(sf::Color::Black);
|
middlePressZone.setFillColor(sf::Color::Black);
|
||||||
rightPressZone.setFillColor(sf::Color::Black);
|
rightPressZone.setFillColor(sf::Color::Black);
|
||||||
|
|
||||||
ScoreText.setPosition({SCREEN_WIDTH - 200, 5});
|
leftPressZone.setOrigin(leftPressZone.getSize() * 0.5f);
|
||||||
|
middlePressZone.setOrigin(middlePressZone.getSize() * 0.5f);
|
||||||
|
rightPressZone.setOrigin(rightPressZone.getSize() * 0.5f);
|
||||||
|
|
||||||
|
ScoreText.setPosition({SCREEN_WIDTH - 150, 70});
|
||||||
ScoreText.setFillColor(sf::Color::Black);
|
ScoreText.setFillColor(sf::Color::Black);
|
||||||
ScoreText.setCharacterSize(20);
|
ScoreText.setCharacterSize(40);
|
||||||
ScoreMultiplierText.setPosition({SCREEN_WIDTH - 200, 25});
|
ScoreMultiplierText.setPosition({SCREEN_WIDTH - 100, 25});
|
||||||
ScoreMultiplierText.setFillColor(sf::Color::Black);
|
ScoreMultiplierText.setFillColor(sf::Color::Black);
|
||||||
ScoreMultiplierText.setCharacterSize(20);
|
ScoreMultiplierText.setCharacterSize(40);
|
||||||
|
|
||||||
if (!bgTexture.loadFromFile("media/sprites/bureau.png")) {
|
if (!bgTexture.loadFromFile("media/sprites/bureau.png")) {
|
||||||
printf("sprite bureau not loaded\n");
|
printf("sprite bureau not loaded\n");
|
||||||
|
@ -168,13 +172,14 @@ void Game::render() {
|
||||||
mWindow.draw(rightPressZone);
|
mWindow.draw(rightPressZone);
|
||||||
|
|
||||||
carrot.draw(mWindow, TimePerFrame.asSeconds());
|
carrot.draw(mWindow, TimePerFrame.asSeconds());
|
||||||
carrot.handleText(mWindow, TimePerFrame.asSeconds());
|
|
||||||
|
|
||||||
if (!NoteTile::update(TimePerFrame.asSeconds(), mWindow))
|
if (!NoteTile::update(TimePerFrame.asSeconds(), mWindow))
|
||||||
update_scores(false);
|
update_scores(false);
|
||||||
if (NoteTile::isFinished()) {
|
if (NoteTile::isFinished()) {
|
||||||
mWindow.draw(endScreen);
|
mWindow.draw(endScreen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
carrot.handleText(mWindow, TimePerFrame.asSeconds());
|
||||||
mWindow.draw(mStatisticsText);
|
mWindow.draw(mStatisticsText);
|
||||||
mWindow.draw(ScoreText);
|
mWindow.draw(ScoreText);
|
||||||
mWindow.draw(ScoreMultiplierText);
|
mWindow.draw(ScoreMultiplierText);
|
||||||
|
@ -188,9 +193,8 @@ void Game::update_scores(bool good_action) {
|
||||||
} else {
|
} else {
|
||||||
score_multiplier = 1;
|
score_multiplier = 1;
|
||||||
}
|
}
|
||||||
ScoreText.setString(std::format("Score = {}", score));
|
ScoreText.setString(std::format("{}pts", score));
|
||||||
ScoreMultiplierText.setString(
|
ScoreMultiplierText.setString(std::format("{}x", score_multiplier));
|
||||||
std::format("ScoreMultiplier = {}", score_multiplier));
|
|
||||||
|
|
||||||
if (score_multiplier < 5) {
|
if (score_multiplier < 5) {
|
||||||
carrot.changeState(Angry);
|
carrot.changeState(Angry);
|
||||||
|
|
|
@ -12,13 +12,16 @@ NoteTile::NoteTile(float play_time, float good_interval, NotePlaceEnum place,
|
||||||
float current_time)
|
float current_time)
|
||||||
: play_time(play_time), good_interval(good_interval), place(place),
|
: play_time(play_time), good_interval(good_interval), place(place),
|
||||||
note_sprite() {
|
note_sprite() {
|
||||||
// TODO do real note_sprite init, make it fall at good speed far enough...
|
|
||||||
note_sprite.fall_speed = 500;
|
note_sprite.fall_speed = 500;
|
||||||
note_sprite.sprite.setPosition(sf::Vector2f(
|
note_sprite.sprite.setPosition(sf::Vector2f(
|
||||||
NOTE_PLACE_X_POS[place],
|
NOTE_PLACE_X_POS[place],
|
||||||
NOTE_PRESS_HEIGHT - note_sprite.fall_speed * (play_time - current_time)));
|
NOTE_PRESS_HEIGHT - note_sprite.fall_speed * (play_time - current_time)));
|
||||||
|
|
||||||
float s = FLOWER_SIZE / note_sprite.sprite.getTexture().getSize().x;
|
sf::Vector2u sprite_size = note_sprite.sprite.getTexture().getSize();
|
||||||
|
note_sprite.sprite.setOrigin(
|
||||||
|
sf::Vector2f(sprite_size.x / 2, sprite_size.y / 2));
|
||||||
|
|
||||||
|
float s = FLOWER_SIZE / sprite_size.x;
|
||||||
note_sprite.sprite.setScale(sf::Vector2f(s, s));
|
note_sprite.sprite.setScale(sf::Vector2f(s, s));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue