From 46ebcb1b5e8fb60616a25c3ef746c284815d9ef8 Mon Sep 17 00:00:00 2001 From: Bogdan Velicu Date: Wed, 1 Nov 2023 18:44:29 +0200 Subject: [PATCH] vector platforme fara pointeri --- .vscode/launch.json | 21 +++ CMakeLists.txt | 2 +- README.md | 6 +- doodle_jump/game/Game.cpp | 194 ++++++++++++------------- doodle_jump/game/Game.h | 18 ++- doodle_jump/game_object/GameObject.cpp | 15 ++ doodle_jump/game_object/GameObject.h | 13 ++ doodle_jump/platform/Platform.cpp | 51 ++++--- doodle_jump/platform/Platform.h | 10 +- doodle_jump/player/Player.cpp | 10 +- doodle_jump/player/Player.h | 6 +- doodle_jump/powerups/Powerups.cpp | 98 +++++++++++++ doodle_jump/powerups/Powerups.h | 31 ++++ my_files.txt | 10 ++ 14 files changed, 340 insertions(+), 145 deletions(-) create mode 100644 .vscode/launch.json create mode 100644 doodle_jump/game_object/GameObject.cpp create mode 100644 doodle_jump/game_object/GameObject.h create mode 100644 doodle_jump/powerups/Powerups.cpp create mode 100644 doodle_jump/powerups/Powerups.h create mode 100644 my_files.txt diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..41655fc --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,21 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(lldb) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/doodle_jump", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "lldb" + } + + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d396cb8..c1e120b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -108,7 +108,7 @@ endif() ############################################################################### # NOTE: update executable name in .github/workflows/cmake.yml:25 when changing name here -add_executable(${PROJECT_NAME} main.cpp doodle_jump/game/Game.cpp doodle_jump/platform/Platform.cpp doodle_jump/player/Player.cpp doodle_jump/screen/GameScreen.cpp doodle_jump/screen/MainMenu.cpp doodle_jump/screen/PlayScreen.cpp doodle_jump/screen/GameOver.cpp) +add_executable(${PROJECT_NAME} main.cpp doodle_jump/game/Game.cpp doodle_jump/platform/Platform.cpp doodle_jump/player/Player.cpp doodle_jump/screen/GameScreen.cpp doodle_jump/screen/MainMenu.cpp doodle_jump/screen/PlayScreen.cpp doodle_jump/screen/GameOver.cpp doodle_jump/game_object/GameObject.cpp doodle_jump/powerups/Powerups.cpp) ############################################################################### diff --git a/README.md b/README.md index dd7527c..b4f52bf 100644 --- a/README.md +++ b/README.md @@ -28,10 +28,10 @@ #### Cerințe - [x] separarea codului din clase în `.h` (sau `.hpp`) și `.cpp` -- [ ] moșteniri: +- [x] moșteniri: - minim o clasă de bază și **3 clase derivate** - ierarhia trebuie să fie cu bază proprie, nu derivată dintr-o clasă predefinită - - [ ] clasă cu atribut de tip pointer la o clasă de bază cu derivate + - [x] clasă cu atribut de tip pointer la o clasă de bază cu derivate - [ ] funcții virtuale (pure) apelate prin pointeri de bază din clasa care conține atributul de tip pointer de bază - minim o funcție virtuală va fi **specifică temei** (e.g. nu simple citiri/afișări) - constructori virtuali (clone): sunt necesari, dar nu se consideră funcții specifice temei @@ -42,7 +42,7 @@ - [ ] excepții - [ ] ierarhie proprie cu baza `std::exception` sau derivată din `std::exception`; minim 2 clase pentru erori specifice - [ ] utilizare cu sens: de exemplu, `throw` în constructor, `try`/`catch` în `main` -- [x] funcții și atribute `static` +- [ ] funcții și atribute `static` - [ ] STL - [x] cât mai multe `const` - [ ] la sfârșit: commit separat cu adăugarea unei noi clase derivate fără a modifica restul codului, pe lângă cele 3 derivate deja adăugate diff --git a/doodle_jump/game/Game.cpp b/doodle_jump/game/Game.cpp index 504cbf7..cbb306d 100644 --- a/doodle_jump/game/Game.cpp +++ b/doodle_jump/game/Game.cpp @@ -13,78 +13,39 @@ Game::Game() { currentScreen = ScreenType::MAIN_MENU; score = 0; maxScore = 0; - player = new Player(); - platforms = std::vector(); + + platformTextures = std::vector(); + initPlatformTextures(); + + platforms = std::vector(); + powerups = std::vector(); + powerup = nullptr; + lastPlatform = new Platform(); - for (int i = 0; i < 15; i++) { - auto platform = new Platform(); - platform->useGenerator(lastPlatform->getSprite().getPosition()); - lastPlatform = platform; + for (int i = 0; i < 20; i++) { + auto platform = Platform(); + platform.useGenerator(lastPlatform->getSprite().getPosition()); + platform.assignTexture(pickTexture(platform.getType())); platforms.push_back(platform); + lastPlatform = &platforms[i]; } font = sf::Font(); font.loadFromFile("fonts/Valoon.ttf"); - scoreText = new sf::Text(); - scoreText->setFont(font); - scoreText->setString(std::to_string(score)); - scoreText->setCharacterSize(36); - scoreText->setFillColor(sf::Color::Black); - scoreText->setPosition(20, 20); + scoreText.setFont(font); + scoreText.setString(std::to_string(score)); + scoreText.setCharacterSize(36); + scoreText.setFillColor(sf::Color::Black); + scoreText.setPosition(20, 20); window.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), windowTitle, sf::Style::Default); - window.setFramerateLimit(120); + window.setFramerateLimit(100); } Game::~Game() { std::cout << "Game destructor called\n"; - delete player; - for (auto& platform : platforms) { - delete platform; - } - delete lastPlatform; - delete scoreText; -} - -Game::Game(const Game& game) { - std::cout << "Game copy constructor called\n"; - currentScreen = game.currentScreen; - - if (window.isOpen()) - window.close(); - window.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), windowTitle, sf::Style::Default); - window.setFramerateLimit(120); - - font = game.font; - score = game.score; - maxScore = game.maxScore; - scoreText = game.scoreText; - player = game.player; - platforms = game.platforms; - lastPlatform = game.lastPlatform; -} - -Game& Game::operator=(const Game& game) { - std::cout << "Game copy assignment operator called\n"; - if (this != &game) { - currentScreen = game.currentScreen; - - if (window.isOpen()) - window.close(); - window.create(sf::VideoMode(SCREEN_WIDTH, SCREEN_HEIGHT), windowTitle, sf::Style::Default); - window.setFramerateLimit(120); - - font = game.font; - score = game.score; - maxScore = game.maxScore; - scoreText = game.scoreText; - player = game.player; - platforms = game.platforms; - lastPlatform = game.lastPlatform; - } - return *this; } std::ostream& operator<<(std::ostream& out, const Game& game) { @@ -95,20 +56,18 @@ std::ostream& operator<<(std::ostream& out, const Game& game) { } void Game::reset() { - delete player; - player = new Player(); - for (auto& platform : platforms) { - delete platform; - } platforms.clear(); lastPlatform = new Platform(); + powerups.clear(); + powerup = nullptr; - for (int i = 0; i < 15; i++) { - auto platform = new Platform(); - platform->useGenerator(lastPlatform->getSprite().getPosition()); - lastPlatform = platform; + for (int i = 0; i < 20; i++) { + auto platform = Platform(); + platform.useGenerator(lastPlatform->getSprite().getPosition()); + platform.assignTexture(pickTexture(platform.getType())); platforms.push_back(platform); + lastPlatform = &platforms[i]; } score = 0; maxScore = 0; @@ -174,7 +133,7 @@ void Game::run() { void Game::checkCollision() { // Get only lower part of player sprite - sf::FloatRect lowerPlayerBounds = player->getSprite().getGlobalBounds(); + sf::FloatRect lowerPlayerBounds = player.getSprite().getGlobalBounds(); lowerPlayerBounds.top += lowerPlayerBounds.height - 5; lowerPlayerBounds.height = 5; @@ -184,39 +143,40 @@ void Game::checkCollision() { changeScreen(ScreenType::GAME_OVER); } else - player->jump(); + player.jump(); } // sf::FloatRect playerBounds = player->getSprite().getGlobalBounds(); for (auto& platform : platforms) { // Get only upper part of platform sprite - sf::FloatRect upperPlatformBounds = platform->getSprite().getGlobalBounds(); + sf::FloatRect upperPlatformBounds = platform.getSprite().getGlobalBounds(); upperPlatformBounds.height = 5; // sf::FloatRect platformBounds = platform->getSprite().getGlobalBounds(); if (lowerPlayerBounds.intersects(upperPlatformBounds)) { - if (player->getSprite().getPosition().y < platform->getSprite().getPosition().y) { + if (player.getSprite().getPosition().y < platform.getSprite().getPosition().y) { // Jump only if player is falling - if (player->getYVelocity() > 0.2f) { - player->jump(); - - if (platform->getType() == PlatformType::BREAKABLE) { - delete platform; - auto plat = new Platform(); - plat->useGenerator(lastPlatform->getSprite().getPosition()); - lastPlatform = plat; - platform = plat; + if (player.getYVelocity() > 0.2f) { + player.jump(); + + if (platform.getType() == PlatformType::BREAKABLE) { + // delete platform; + auto plat = Platform(); + plat.useGenerator(lastPlatform->getSprite().getPosition()); + plat.assignTexture(pickTexture(plat.getType())); + platforms[&platform - &platforms[0]] = plat; + lastPlatform = &platforms[&platform - &platforms[0]]; } - else if (platform->getType() == PlatformType::BOOST) { - player->setYVelocity(-20.0f); + else if (platform.getType() == PlatformType::BOOST) { + player.setYVelocity(-20.0f); } } } } // Handle moving platforms - if (platform->getType() == PlatformType::MOVING) { - platform->animateMovement(); + if (platform.getType() == PlatformType::MOVING) { + platform.animateMovement(); } } } @@ -234,34 +194,35 @@ void Game::checkCollision() { // } void Game::play() { - player->update(); + player.update(); checkCollision(); - sf::Vector2f velocity = player->getVelocity(); + sf::Vector2f velocity = player.getVelocity(); - if (player->getSprite().getPosition().y < 300 && maxScore - score < 200) { + if (player.getSprite().getPosition().y < 300 && maxScore - score < 200) { for (auto& platform : platforms) { - if (platform->getSprite().getPosition().y > 750.0f) { - delete platform; - auto plat = new Platform(); - plat->useGenerator(lastPlatform->getSprite().getPosition()); - lastPlatform = plat; - platform = plat; + if (platform.getSprite().getPosition().y > 750.0f) { + // delete platform; + auto plat = Platform(); + plat.useGenerator(lastPlatform->getSprite().getPosition()); + plat.assignTexture(pickTexture(plat.getType())); + platforms[&platform - &platforms[0]] = plat; + lastPlatform = &platforms[&platform - &platforms[0]]; } - float yVelocity = player->getYVelocity(); - platform->moveSprite({0.0f, -yVelocity}); + float yVelocity = player.getYVelocity(); + platform.moveSprite({0.0f, -yVelocity}); } } else { - player->moveSprite({0.0f, velocity.y}); + player.moveSprite({0.0f, velocity.y}); } - player->moveSprite({velocity.x, 0.0f}); + player.moveSprite({velocity.x, 0.0f}); window.clear(sf::Color::White); - window.draw(player->getSprite()); + player.draw(window, player.getSprite()); for (auto& platform : platforms) { - window.draw(platform->getSprite()); + platform.draw(window, platform.getSprite()); } displayScore(); // displayDebugInfo(); @@ -269,13 +230,42 @@ void Game::play() { window.display(); } +void Game::initPlatformTextures() { + platformTextures.emplace_back(); + platformTextures[0].loadFromFile("assets/platform.png"); + + platformTextures.emplace_back(); + platformTextures[1].loadFromFile("assets/platform_break.png"); + + platformTextures.emplace_back(); + platformTextures[2].loadFromFile("assets/platform_moving.png"); + + platformTextures.emplace_back(); + platformTextures[3].loadFromFile("assets/platform_boost.png"); +} + +sf::Texture& Game::pickTexture(PlatformType platformType) { + switch (platformType) { + case PlatformType::NORMAL: + return platformTextures[0]; + case PlatformType::BREAKABLE: + return platformTextures[1]; + case PlatformType::MOVING: + return platformTextures[2]; + case PlatformType::BOOST: + return platformTextures[3]; + default: + return platformTextures[0]; + } +} + void Game::displayScore() { - score -= player->getYVelocity(); + score -= player.getYVelocity(); if (score > maxScore) maxScore = score; - scoreText->setString("Score: " + std::to_string((int)maxScore)); - window.draw(*scoreText); + scoreText.setString("Score: " + std::to_string((int)maxScore)); + window.draw(scoreText); } void Game::changeScreen(ScreenType screenType) { diff --git a/doodle_jump/game/Game.h b/doodle_jump/game/Game.h index ed5fa41..36a782c 100644 --- a/doodle_jump/game/Game.h +++ b/doodle_jump/game/Game.h @@ -1,6 +1,7 @@ #include "./../platform/Platform.h" #include "./../player/Player.h" #include "./../screen/GameScreen.h" +#include "./../powerups/Powerups.h" #include #include @@ -14,21 +15,26 @@ class Game { sf::Font font; float score; float maxScore; - sf::Text *scoreText; - Player *player; - std::vector platforms; - Platform* lastPlatform; + sf::Text scoreText; + Player player; + std::vector platformTextures; + std::vector platforms; + std::vector powerups; + GameObject *powerup; + Platform *lastPlatform; public: Game(); ~Game(); - Game(const Game& game); // for cppcheck - Game& operator=(const Game& game); // for cppcheck + Game(const Game& game) = delete; + Game& operator=(const Game& game) = delete; friend std::ostream& operator<<(std::ostream& out, const Game& game); void run(); void changeScreen(ScreenType screenType); void play(); void reset(); // void displayDebugInfo(); + void initPlatformTextures(); + sf::Texture& pickTexture(PlatformType platformType); void displayScore(); void checkCollision(); }; \ No newline at end of file diff --git a/doodle_jump/game_object/GameObject.cpp b/doodle_jump/game_object/GameObject.cpp new file mode 100644 index 0000000..43d3561 --- /dev/null +++ b/doodle_jump/game_object/GameObject.cpp @@ -0,0 +1,15 @@ +#include "GameObject.h" + +#include + +GameObject::GameObject() { + std::cout << "GameObject constructor called\n"; +} + +GameObject::~GameObject() { + std::cout << "GameObject destructor called\n"; +} + +void GameObject::draw(sf::RenderWindow &window, const sf::Sprite& sprite) { + window.draw(sprite); +} diff --git a/doodle_jump/game_object/GameObject.h b/doodle_jump/game_object/GameObject.h new file mode 100644 index 0000000..9e584d9 --- /dev/null +++ b/doodle_jump/game_object/GameObject.h @@ -0,0 +1,13 @@ +#pragma once + +#include + +class GameObject { +private: + sf::Texture texture; + sf::Sprite sprite; +public: + GameObject(); + virtual ~GameObject(); + virtual void draw(sf::RenderWindow& window, const sf::Sprite& sprite); +}; \ No newline at end of file diff --git a/doodle_jump/platform/Platform.cpp b/doodle_jump/platform/Platform.cpp index cf23026..c363a61 100644 --- a/doodle_jump/platform/Platform.cpp +++ b/doodle_jump/platform/Platform.cpp @@ -9,6 +9,8 @@ Platform::Platform() { updateCount = 0; type = PlatformType::NORMAL; + texture = new sf::Texture(); + int x = 0; int y = 800; @@ -19,8 +21,10 @@ Platform::~Platform() { std::cout << "Platform destructor called\n"; } -Platform::Platform(const Platform& platform) : texture(platform.texture), sprite(platform.sprite) { +Platform::Platform(const Platform& platform) { std::cout << "Platform copy constructor called\n"; + texture = platform.texture; + sprite = platform.sprite; type = platform.type; updateCount = platform.updateCount; } @@ -65,26 +69,31 @@ void Platform::useGenerator(const sf::Vector2f& lastPlatformCoordinates) { type = platformType; - switch (platformType) { - case PlatformType::NORMAL: - texture.loadFromFile("assets/platform.png"); - break; - case PlatformType::BREAKABLE: - texture.loadFromFile("assets/platform_break.png"); - break; - case PlatformType::MOVING: - texture.loadFromFile("assets/platform_moving.png"); - break; - case PlatformType::BOOST: - texture.loadFromFile("assets/platform_boost.png"); - break; - default: - break; - } - sprite.setTexture(texture); + // switch (platformType) { + // case PlatformType::NORMAL: + // texture.loadFromFile("assets/platform.png"); + // break; + // case PlatformType::BREAKABLE: + // texture.loadFromFile("assets/platform_break.png"); + // break; + // case PlatformType::MOVING: + // texture.loadFromFile("assets/platform_moving.png"); + // break; + // case PlatformType::BOOST: + // texture.loadFromFile("assets/platform_boost.png"); + // break; + // default: + // break; + // } + // sprite.setTexture(texture); sprite.setPosition((float)x, (float)y); } +void Platform::assignTexture(sf::Texture& texture_) { + texture = &texture_; + sprite.setTexture(*texture); +} + std::ostream& operator<<(std::ostream& os, const PlatformType& platformType) { switch (platformType) { case PlatformType::NORMAL: @@ -137,6 +146,6 @@ sf::Sprite Platform::getSprite() const { return sprite; } -// sf::Texture Platform::getTexture() const { -// return texture; -// } \ No newline at end of file +void Platform::draw(sf::RenderWindow& window, const sf::Sprite& _sprite) { + window.draw(_sprite); +} \ No newline at end of file diff --git a/doodle_jump/platform/Platform.h b/doodle_jump/platform/Platform.h index 4a6618a..363e5e2 100644 --- a/doodle_jump/platform/Platform.h +++ b/doodle_jump/platform/Platform.h @@ -1,5 +1,6 @@ #pragma once +#include "../game_object/GameObject.h" #include #include @@ -11,11 +12,11 @@ enum class PlatformType { }; std::ostream& operator<<(std::ostream& os, const PlatformType& platformType); -class Platform { +class Platform : public GameObject { private: PlatformType type; - sf::Texture texture = sf::Texture(); - sf::Sprite sprite = sf::Sprite(); + sf::Texture *texture; + sf::Sprite sprite; int updateCount; public: Platform(); @@ -26,7 +27,8 @@ class Platform { friend std::ostream& operator<<(std::ostream& os, const Platform& platform); PlatformType getType() const; sf::Sprite getSprite() const; - // sf::Texture getTexture() const; void moveSprite(const sf::Vector2f& coordinates_); void animateMovement(); + void assignTexture(sf::Texture& texture_); + void draw(sf::RenderWindow& window, const sf::Sprite& sprite) override; }; \ No newline at end of file diff --git a/doodle_jump/player/Player.cpp b/doodle_jump/player/Player.cpp index 838fed4..5e1c60a 100644 --- a/doodle_jump/player/Player.cpp +++ b/doodle_jump/player/Player.cpp @@ -116,10 +116,6 @@ std::ostream& operator<<(std::ostream& out, const Player& player) { return out; } -// sf::Vector2f Player::getCoordinates() const { -// return sprite->getPosition(); -// } - -// void Player::setCoordinates(const sf::Vector2f& coordinates_) { -// sprite->setPosition(coordinates_); -// } \ No newline at end of file +void Player::draw(sf::RenderWindow& window, const sf::Sprite& _sprite) { + window.draw(_sprite); +} \ No newline at end of file diff --git a/doodle_jump/player/Player.h b/doodle_jump/player/Player.h index 0ea9285..feb0d6c 100644 --- a/doodle_jump/player/Player.h +++ b/doodle_jump/player/Player.h @@ -1,5 +1,7 @@ #include +#include "../game_object/GameObject.h" + enum class PlayerState { STANDING, JUMPING, @@ -8,7 +10,7 @@ enum class PlayerState { MOVING_RIGHT, }; -class Player { +class Player : public GameObject { private: sf::Texture texture = sf::Texture(); PlayerState state = PlayerState::STANDING; @@ -39,4 +41,6 @@ class Player { void jump(); void moveLeft(); void moveRight(); + + void draw(sf::RenderWindow& window, const sf::Sprite& sprite) override; }; \ No newline at end of file diff --git a/doodle_jump/powerups/Powerups.cpp b/doodle_jump/powerups/Powerups.cpp new file mode 100644 index 0000000..d8f69c0 --- /dev/null +++ b/doodle_jump/powerups/Powerups.cpp @@ -0,0 +1,98 @@ +#include "Powerups.h" + +#include +#include + +Powerups::Powerups() { + std::cout << "Powerups constructor called\n"; + updateCount = 0; + type = PowerupsType::JETPACK; + gameObject = nullptr; +} + +Powerups::~Powerups() { + std::cout << "Powerups destructor called\n"; +} + +std::ostream& operator<<(std::ostream& out, const PowerupsType& powerupsType) { + switch (powerupsType) { + case PowerupsType::ROCKET: + out << "Rocket"; + break; + case PowerupsType::SHIELD: + out << "Shield"; + break; + case PowerupsType::JETPACK: + out << "Jetpack"; + break; + } + return out; +} + +void Powerups::setGameObject(GameObject *gameObject_) { + gameObject = gameObject_; +} + +void Powerups::useGenerator(const sf::Vector2f& lastPlatformCoordinates) { + std::cout << "Powerups constructor called\n"; + + PowerupsType powerupsType = PowerupsType::JETPACK; + updateCount = 0; + int random = rand() % 300; + + // 30% chance of generating a rocket powerup + // 30% chance of generating a shield powerup + // 30% chance of generating a jetpack powerup + + if (random < 100) { + powerupsType = PowerupsType::ROCKET; + } else if (random < 200) { + powerupsType = PowerupsType::SHIELD; + } else if (random < 300) { + powerupsType = PowerupsType::JETPACK; + } + + float x = lastPlatformCoordinates.x; + + float y = lastPlatformCoordinates.y - 30; + + sprite.setPosition(x, y); + type = powerupsType; +} + +std::ostream& operator<<(std::ostream& os, const Powerups& powerups) { + os << "Powerups object\n" + << "Type: " << powerups.type << '\n' + << "Update count: " << powerups.updateCount << '\n'; + return os; +} + +PowerupsType Powerups::getType() const { + return type; +} + +sf::Sprite Powerups::getSprite() const { + return sprite; +} + +void Powerups::moveSprite(const sf::Vector2f& coordinates_) { + sprite.move(coordinates_); +} + +void Powerups::animateMovement() { + updateCount++; + if (updateCount == 100) { + updateCount = 0; + } + sprite.move(0.0f, 1.0f); +} + +void Powerups::draw(sf::RenderWindow& window, const sf::Sprite& sprite_) { + // window.draw(sprite_); + if (gameObject != nullptr) { + gameObject->draw(window, sprite_); + } + else { + std::cout << "Powerups::draw() gameObject is nullptr\n"; + } +} \ No newline at end of file diff --git a/doodle_jump/powerups/Powerups.h b/doodle_jump/powerups/Powerups.h new file mode 100644 index 0000000..6e4e0a9 --- /dev/null +++ b/doodle_jump/powerups/Powerups.h @@ -0,0 +1,31 @@ +#pragma once + +#include "../game_object/GameObject.h" +#include + +enum class PowerupsType { + ROCKET, + SHIELD, + JETPACK, +}; +std::ostream& operator<<(std::ostream& out, const PowerupsType& powerupsType); + +class Powerups : public GameObject { +private: + sf::Texture texture = sf::Texture(); + sf::Sprite sprite = sf::Sprite(); + PowerupsType type; + GameObject* gameObject; + int updateCount; +public: + Powerups(); + ~Powerups(); + void useGenerator(const sf::Vector2f& lastPlatformCoordinates); + friend std::ostream& operator<<(std::ostream& os, const Powerups& powerups); + PowerupsType getType() const; + sf::Sprite getSprite() const; + void setGameObject(GameObject* gameObject_); + void moveSprite(const sf::Vector2f& coordinates_); + void animateMovement(); + void draw(sf::RenderWindow& window, const sf::Sprite& sprite) override; +}; \ No newline at end of file diff --git a/my_files.txt b/my_files.txt new file mode 100644 index 0000000..62579a1 --- /dev/null +++ b/my_files.txt @@ -0,0 +1,10 @@ +main.cpp +doodle_jump/game/Game.cpp +doodle_jump/game_object/GameObject.cpp +doodle_jump/platform/Platform.cpp +doodle_jump/player/Player.cpp +doodle_jump/powerups/Powerups.cpp +doodle_jump/screen/GameScreen.cpp +doodle_jump/screen/MainMenu.cpp +doodle_jump/screen/GameOver.cpp +doodle_jump/screen/PlayScreen.cpp \ No newline at end of file