├── .gitignore ├── Account.cpp ├── Account.h ├── Bonus.cpp ├── Bonus.h ├── CMakeLists.txt ├── Config.cpp ├── Config.h ├── Credits.cpp ├── Credits.h ├── Ennemy.cpp ├── Ennemy.h ├── Game.cpp ├── Game.h ├── Laser.cpp ├── Laser.h ├── Menu.cpp ├── Menu.h ├── Meteor.cpp ├── Meteor.h ├── MyButton.cpp ├── MyButton.h ├── MyCheckbox.cpp ├── MyCheckbox.h ├── MyProgressBar.cpp ├── MyProgressBar.h ├── MyWindow.cpp ├── MyWindow.h ├── Obstacle.cpp ├── Obstacle.h ├── Panel.cpp ├── Panel.h ├── README.md ├── Score.cpp ├── Score.h ├── Settings.cpp ├── Settings.h ├── Shop.cpp ├── Shop.h ├── Spaceship.cpp ├── Spaceship.h ├── Splashscreen.cpp ├── Splashscreen.h ├── Star.cpp ├── Star.h ├── config.cfg ├── doc ├── screenshot0.PNG ├── screenshot1.PNG ├── screenshot2.PNG ├── screenshot3.PNG ├── screenshot4.PNG ├── screenshot5.PNG ├── screenshot6.PNG └── screenshot7.PNG ├── fonts └── masterbreaker.ttf ├── icon.ico ├── images ├── account │ ├── color.png │ ├── color0.png │ ├── color1.png │ ├── color2.png │ ├── color3.png │ ├── color4.png │ ├── color5.png │ ├── color6.png │ ├── color7.png │ ├── exp_bar.png │ ├── selectedColor.png │ ├── spaceship0.png │ ├── spaceship0_s.png │ ├── spaceship1.png │ ├── spaceship1_s.png │ ├── spaceship2.png │ ├── spaceship2_s.png │ ├── spaceship3.png │ ├── spaceship3_s.png │ ├── spaceship4.png │ ├── spaceship4_s.png │ ├── spaceship5.png │ ├── spaceship5_s.png │ ├── spaceship6.png │ ├── spaceship6_s.png │ ├── spaceship7.png │ ├── spaceship7_s.png │ ├── spaceship8.png │ └── spaceship8_s.png ├── background.png ├── bonus │ ├── bonus.png │ ├── bonus0.png │ ├── bonus1.png │ ├── bonus2.png │ └── bonus4.png ├── game │ ├── bonus.png │ ├── btn_menu.png │ ├── btn_menu_s.png │ ├── btn_quit.png │ ├── btn_quit_s.png │ ├── gameover.png │ ├── health.png │ ├── menu_pause.png │ ├── restart.png │ ├── restart_s.png │ └── score.png ├── icon.png ├── lasers │ ├── blue.png │ ├── green.png │ ├── red.png │ └── yellow.png ├── menu │ ├── btn_account.png │ ├── btn_account_s.png │ ├── btn_credits.png │ ├── btn_credits_s.png │ ├── btn_play.png │ ├── btn_play_s.png │ ├── btn_score.png │ ├── btn_score_s.png │ ├── btn_settings.png │ ├── btn_settings_s.png │ ├── btn_shop.png │ └── btn_shop_s.png ├── obstacles │ ├── ennemy0.png │ ├── ennemy1.png │ ├── ennemy2.png │ ├── ennemy3.png │ ├── ennemy4.png │ ├── heal.png │ ├── meteor0.png │ ├── meteor1.png │ ├── meteor2.png │ ├── random.png │ └── star.png ├── scoreboard │ ├── date.png │ ├── rank.png │ └── score.png ├── settings │ ├── back.png │ ├── back_s.png │ ├── checkbox.png │ ├── checkbox_s.png │ ├── fps.png │ ├── fps_bar.png │ ├── music.png │ ├── rect_bar.png │ ├── vol_bar.png │ ├── volume.png │ └── vsync.png ├── shop │ ├── card0.png │ ├── card0_s.png │ ├── card1.png │ ├── card10.png │ ├── card10_s.png │ ├── card11.png │ ├── card11_s.png │ ├── card12.png │ ├── card12_s.png │ ├── card13.png │ ├── card13_s.png │ ├── card14.png │ ├── card14_s.png │ ├── card1_s.png │ ├── card2.png │ ├── card2_s.png │ ├── card3.png │ ├── card3_s.png │ ├── card4.png │ ├── card4_s.png │ ├── card5.png │ ├── card5_s.png │ ├── card6.png │ ├── card6_s.png │ ├── card7.png │ ├── card7_s.png │ ├── card8.png │ ├── card8_s.png │ ├── card9.png │ └── card9_s.png ├── spaceships │ ├── spaceship0 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship1 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship2 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship3 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship4 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship5 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship6 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ ├── spaceship7 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png │ └── spaceship8 │ │ ├── blue.png │ │ ├── green.png │ │ ├── grey.png │ │ ├── orange.png │ │ ├── pink.png │ │ ├── purple.png │ │ ├── red.png │ │ └── yellow.png └── splashscreen │ ├── btn_keys.png │ ├── logo.png │ └── shadow.png ├── main.cpp ├── resource.rc └── sounds ├── button.wav └── laser.wav /.gitignore: -------------------------------------------------------------------------------- 1 | # exclude local build folder (if any) 2 | build 3 | -------------------------------------------------------------------------------- /Account.cpp: -------------------------------------------------------------------------------- 1 | #include "Account.h" 2 | #include "Spaceship.h" 3 | 4 | /* 5 | * Constructor 6 | */ 7 | Account::Account(MyWindow* window) : Panel(window) 8 | { 9 | //Init 10 | if (!font.loadFromFile("fonts/masterbreaker.ttf")) {} 11 | if (!selectedColor.loadFromFile("images/account/selectedColor.png")) {}; 12 | if (!xp.loadFromFile("images/account/exp_bar.png")) {}; 13 | if (!star.loadFromFile("images/obstacles/star.png")) {}; 14 | back = MyButton("images/settings/back.png", "images/settings/back_s.png"); 15 | back.changeTexture(false); 16 | 17 | _selectedColor = sf::Sprite(selectedColor); 18 | _xp = sf::Sprite(xp); 19 | _star = sf::Sprite(star); 20 | 21 | level = sf::Text(getWindow()->getConfig()->getLevelString(), font, 120); 22 | nbrStar = sf::Text(getWindow()->getConfig()->getNbrStarString(), font, 80); 23 | 24 | rectXp = sf::RectangleShape(sf::Vector2f((int)(325 * getWindow()->getConfig()->getXp()), 33)); 25 | rectXp.setFillColor(sf::Color(249, 148, 7)); 26 | level.setFillColor(sf::Color(249, 148, 7)); 27 | nbrStar.setFillColor(sf::Color(249, 148, 7)); 28 | 29 | //Init vectors 30 | std::stringstream path, path2; 31 | MyButton tmp; 32 | int x, y; 33 | 34 | //Spaceships 35 | for (size_t i = 0; i < 8; i++) { 36 | path.str(""); 37 | path2.str(""); 38 | path << "images/account/spaceship" << i << ".png"; 39 | path2 << "images/account/spaceship" << i << "_s.png"; 40 | tmp = MyButton(path.str(), path2.str()); 41 | tmp.setVolume(getWindow()->getConfig()->getVolume()); 42 | tmp.setToDo(i); 43 | x = 437 + ((i % 4) * 157); 44 | y = 340 + ((i / 4) * 171); 45 | tmp.setPosition(x, y); 46 | spaceships.push_back(tmp); 47 | } 48 | tmp = MyButton("images/account/spaceship8.png", "images/account/spaceship8_s.png"); 49 | tmp.setPosition(1048, 451); 50 | tmp.setToDo(8); 51 | spaceships.push_back(tmp); 52 | //Colors 53 | for (size_t i = 0; i < 7; i++) { 54 | path.str(""); 55 | path2.str(""); 56 | path << "images/account/color.png"; 57 | path2 << "images/account/color" << i << ".png"; 58 | tmp = MyButton(path.str(), path2.str()); 59 | tmp.setVolume(getWindow()->getConfig()->getVolume()); 60 | tmp.setToDo(i); 61 | x = 449 + (i * 85); 62 | tmp.setPosition(x, 653); 63 | colors.push_back(tmp); 64 | } 65 | 66 | //Init positions 67 | level.setPosition(712-level.getLocalBounds().width/2, 21); 68 | nbrStar.setPosition(710-nbrStar.getLocalBounds().width/2, 192); 69 | _xp.setPosition(567, 168); 70 | _star.setPosition(718 + nbrStar.getLocalBounds().width, 220); 71 | rectXp.setPosition(570, 171); 72 | back.setPosition(23, 28); 73 | } 74 | 75 | /* 76 | * Draw and position all sprites in the panel 77 | */ 78 | void Account::init() 79 | { 80 | level.setString(getWindow()->getConfig()->getLevelString()); 81 | nbrStar.setString(getWindow()->getConfig()->getNbrStarString()); 82 | level.setPosition(702 - level.getLocalBounds().width / 2, 21); 83 | nbrStar.setPosition(680 - nbrStar.getLocalBounds().width / 2, 192); 84 | _star.setPosition(688 + nbrStar.getLocalBounds().width / 2, 220); 85 | rectXp.setSize(sf::Vector2f((int)(325 * getWindow()->getConfig()->getXp()), 33)); 86 | back.setVolume(getWindow()->getConfig()->getVolume()); 87 | 88 | getWindow()->clear(); 89 | getWindow()->draw(getBackground()); 90 | 91 | for (size_t i = 0; i < spaceships.size(); i++) { 92 | if (i == getWindow()->getConfig()->getSelectedSpaceship()) { 93 | spaceships[i].changeTexture(true); 94 | } 95 | else { 96 | spaceships[i].changeTexture(false); 97 | } 98 | getWindow()->draw(spaceships[i].getSprite()); 99 | } 100 | for (size_t i = 0; i < colors.size(); i++) { 101 | if (getWindow()->getConfig()->getColors()[getWindow()->getConfig()->getSelectedSpaceship()]) { 102 | colors[i].changeTexture(true); 103 | } 104 | else { 105 | colors[i].changeTexture(false); 106 | } 107 | if (i == getWindow()->getConfig()->getSelectedColor()) { 108 | _selectedColor.setPosition(444 + (i * 85), 648); 109 | } 110 | getWindow()->draw(colors[i].getSprite()); 111 | } 112 | 113 | getWindow()->draw(level); 114 | getWindow()->draw(nbrStar); 115 | getWindow()->draw(_star); 116 | getWindow()->draw(rectXp); 117 | getWindow()->draw(_xp); 118 | getWindow()->draw(back.getSprite()); 119 | getWindow()->draw(_selectedColor); 120 | } 121 | 122 | /* 123 | * Keyboard listener (key pressed once) 124 | */ 125 | int Account::keyPressedOnce(sf::Keyboard::Key key) 126 | { 127 | switch (key) { 128 | case(sf::Keyboard::Key::Escape): return Panel::PANEL_MENU; break; 129 | } 130 | return -1; 131 | } 132 | 133 | /* 134 | * Mouse listener (mouse moved) 135 | */ 136 | int Account::mouseMove(int x, int y) { 137 | if (back.isSelected(x, y)) { 138 | back.changeTexture(); 139 | } 140 | return -1; 141 | } 142 | 143 | /* 144 | * Mouse listener (mouse pressed) 145 | */ 146 | int Account::mouseClicked(int x, int y, sf::Mouse::Button button) 147 | { 148 | if (button == sf::Mouse::Button::Left) { 149 | if (back.isSelected(x, y)) { 150 | back.changeTexture(); 151 | return Panel::PANEL_MENU; 152 | } 153 | else { 154 | for (size_t i = 0; i < spaceships.size(); i++) { 155 | if (spaceships[i].isSelected(x, y) && getWindow()->getConfig()->setSelectedSpaceship(i)) { 156 | spaceships[i].changeTexture(); 157 | getWindow()->getConfig()->setSelectedSpaceship(i); 158 | if (getWindow()->getConfig()->getColors()[i] == true) { 159 | for (size_t j = 0; j < colors.size(); j++) { 160 | colors[j].changeTexture(true); 161 | } 162 | } 163 | else { 164 | for (size_t j = 0; j < colors.size(); j++) { 165 | colors[j].changeTexture(false); 166 | } 167 | getWindow()->getConfig()->setSelectedColor(i); 168 | } 169 | } 170 | } 171 | for (size_t i = 0; i < colors.size(); i++) { 172 | if (colors[i].isSelected(x, y) && getWindow()->getConfig()->setSelectedColor(i)) { 173 | getWindow()->getConfig()->setSelectedColor(i); 174 | } 175 | } 176 | } 177 | } 178 | return -1; 179 | } 180 | /* 181 | * Return the panel type as an int 182 | */ 183 | 184 | int Account::getType() const 185 | { 186 | return Panel::PANEL_ACCOUNT; 187 | } 188 | -------------------------------------------------------------------------------- /Account.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyButton.h" 3 | #include 4 | #pragma once 5 | class Account : public Panel 6 | { 7 | private: 8 | sf::Font font; 9 | sf::Text level, nbrStar; 10 | sf::Texture xp, star, selectedColor; 11 | sf::Sprite _xp, _star, _selectedColor; 12 | sf::RectangleShape rectXp; 13 | MyButton back; 14 | std::vector spaceships; 15 | std::vector colors; 16 | public: 17 | Account(MyWindow* window); 18 | void init(); 19 | //Listeners 20 | int keyPressedOnce(sf::Keyboard::Key key); 21 | int mouseMove(int x, int y); 22 | int mouseClicked(int x, int y, sf::Mouse::Button button); 23 | //Getters 24 | int getType() const; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /Bonus.cpp: -------------------------------------------------------------------------------- 1 | #include "Bonus.h" 2 | #include 3 | #include 4 | 5 | /* 6 | * Constructor 7 | */ 8 | Bonus::Bonus(int minX, int minY, int y) 9 | { 10 | _bonus = y % 5; 11 | //Sprite loading 12 | if (_bonus == Bonus::BONUS_TYPE_HEAL) { 13 | if (!texture.loadFromFile("images/obstacles/heal.png")) {}; 14 | } 15 | else { 16 | if (!texture.loadFromFile("images/obstacles/random.png")) {}; 17 | } 18 | sprite = sf::Sprite(texture); 19 | //Set position out of screen 20 | int posX = minX + texture.getSize().x; 21 | int posY = y % (minY - texture.getSize().y); 22 | sprite.setPosition(posX, posY); 23 | //Set type 24 | _type = Obstacle::TYPE_BONUS; 25 | } 26 | 27 | /* 28 | * Destructor 29 | */ 30 | Bonus::~Bonus() 31 | { 32 | } 33 | 34 | /* 35 | * Return the bonus sprite for the bonus type parameter 36 | */ 37 | std::string Bonus::getBonusSprite(int typeBonus) 38 | { 39 | if (typeBonus == -1) return "images/bonus/bonus.png"; 40 | std::stringstream ss; 41 | ss << "images/bonus/bonus" << typeBonus << ".png"; 42 | return ss.str(); 43 | } 44 | 45 | /* 46 | * Return the correct laser color for the bonus type parameter 47 | */ 48 | int Bonus::getColorLaser(int typeBonus) 49 | { 50 | switch (typeBonus) 51 | { 52 | case Bonus::BONUS_TYPE_DAMAGE: return Laser::LASER_TYPE_RED; 53 | case Bonus::BONUS_TYPE_SPEED: return Laser::LASER_TYPE_GREEN; 54 | case Bonus::BONUS_TYPE_METEOR: return Laser::LASER_TYPE_YELLOW; 55 | default: return Laser::LASER_TYPE_BLUE; break; 56 | } 57 | } 58 | 59 | /* 60 | * Return the bonus type as an integer 61 | */ 62 | int Bonus::getBonus() const 63 | { 64 | return _bonus; 65 | } 66 | -------------------------------------------------------------------------------- /Bonus.h: -------------------------------------------------------------------------------- 1 | #include "Obstacle.h" 2 | #include "Laser.h" 3 | #pragma once 4 | class Bonus : public Obstacle 5 | { 6 | private : 7 | int _bonus; 8 | public: 9 | static std::string getBonusSprite(int typeBonus); 10 | static int getColorLaser(int typeBonus); 11 | enum { 12 | BONUS_TYPE_GOD, 13 | BONUS_TYPE_DAMAGE, 14 | BONUS_TYPE_SPEED, 15 | BONUS_TYPE_HEAL, 16 | BONUS_TYPE_METEOR 17 | }; 18 | Bonus(int minX, int minY, int y); 19 | ~Bonus(); 20 | //Getters 21 | int getBonus() const; 22 | }; 23 | 24 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # Set a minimum CMake vversion 2 | cmake_minimum_required(VERSION 3.0.2) 3 | 4 | # Define our project name 5 | project(SpaceGO) 6 | 7 | # Look for the SFML components we're interested in 8 | find_package(SFML 2.4 COMPONENTS audio graphics window system REQUIRED) 9 | 10 | # Define a list of our source files 11 | set(SOURCES 12 | Account.cpp 13 | Account.h 14 | Bonus.cpp 15 | Bonus.h 16 | Config.cpp 17 | Config.h 18 | Credits.cpp 19 | Credits.h 20 | Ennemy.cpp 21 | Ennemy.h 22 | Game.cpp 23 | Game.h 24 | Laser.cpp 25 | Laser.h 26 | Menu.cpp 27 | Menu.h 28 | Meteor.cpp 29 | Meteor.h 30 | MyButton.cpp 31 | MyButton.h 32 | MyCheckbox.cpp 33 | MyCheckbox.h 34 | MyProgressBar.cpp 35 | MyProgressBar.h 36 | MyWindow.cpp 37 | MyWindow.h 38 | Obstacle.cpp 39 | Obstacle.h 40 | Panel.cpp 41 | Panel.h 42 | Score.cpp 43 | Score.h 44 | Settings.cpp 45 | Settings.h 46 | Shop.cpp 47 | Shop.h 48 | Spaceship.cpp 49 | Spaceship.h 50 | Splashscreen.cpp 51 | Splashscreen.h 52 | Star.cpp 53 | Star.h 54 | main.cpp 55 | resource.rc 56 | ) 57 | 58 | # Define our target executable based on the source files above 59 | add_executable(SpaceGO ${SOURCES}) 60 | 61 | # Link our executable to SFML and its dependencies 62 | target_link_libraries(SpaceGO sfml-audio sfml-graphics sfml-window sfml-system) 63 | 64 | # Set our source directory as the startup directory for debugging 65 | set_target_properties(SpaceGO PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) 66 | -------------------------------------------------------------------------------- /Config.cpp: -------------------------------------------------------------------------------- 1 | #include "Config.h" 2 | #include "Spaceship.h" 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | /* 10 | * Constructor 11 | */ 12 | Config::Config() 13 | { 14 | load(); 15 | } 16 | 17 | /* 18 | * Destructor 19 | */ 20 | Config::~Config() 21 | {} 22 | 23 | /* 24 | * Save the current configuration 25 | */ 26 | void Config::save() 27 | { 28 | if (_noReset == 0 || _lvl<=0) { 29 | reset(); 30 | } 31 | std::ofstream ofs("config.cfg"); 32 | ofs << *this; 33 | ofs.close(); 34 | } 35 | 36 | /* 37 | * Load the last configuration 38 | */ 39 | void Config::load() { 40 | std::ifstream ifs("config.cfg"); 41 | ifs >> *this; 42 | } 43 | 44 | /* 45 | * Reset the current configuration 46 | */ 47 | void Config::reset() 48 | { 49 | _noReset = true; 50 | _volume = 50; 51 | _lvl = 1; 52 | _xp = 0; 53 | _nbrStar = 0; 54 | _sSpaceship = 0; 55 | _sColor = 0; 56 | _music = true; 57 | _vsync = true; 58 | spaceships = {true, false, false, false, false, false, false, false, true}; 59 | colors = { true, false, false, false, false, false, false, false, false }; 60 | scores = {}; 61 | dates = {}; 62 | } 63 | 64 | /* 65 | * Overwrite << operator to print configuration in a file 66 | */ 67 | std::ostream& operator<<(std::ostream& os, const Config& c) 68 | { 69 | os << c._noReset << '\n'; 70 | os << c._volume << '\n'; 71 | os << c._lvl << '\n'; 72 | os << c._xp << '\n'; 73 | os << c._nbrStar << '\n'; 74 | os << c._sSpaceship << '\n'; 75 | os << c._sColor << '\n'; 76 | os << c._music << '\n'; 77 | os << c._vsync << '\n'; 78 | os << c.getSpaceships().size() << '\n'; 79 | for (size_t i = 0; i < c.getSpaceships().size(); i++) { 80 | os << c.getSpaceships()[i] << '\n'; 81 | } 82 | os << c.getColors().size() << '\n'; 83 | for (size_t i = 0; i < c.getColors().size(); i++) { 84 | os << c.getColors()[i] << '\n'; 85 | } 86 | os << c.getScores().size() << '\n'; 87 | for (size_t i = 0; i < c.getScores().size(); i++) { 88 | os << c.getScores()[i] << '\n'; 89 | } 90 | os << c.getDates().size() << '\n'; 91 | for (size_t i = 0; i < c.getDates().size(); i++) { 92 | os << c.getDates()[i] << '\n'; 93 | } 94 | return os; 95 | } 96 | 97 | /* 98 | * Overwrite >> operator to read configuration in a file 99 | */ 100 | std::istream& operator>>(std::istream& is, Config& c) 101 | { 102 | int n = 0, tmpInt; 103 | std::string tmpString; 104 | is >> c._noReset >> c._volume >> c._lvl >> c._xp >> c._nbrStar >> c._sSpaceship >> c._sColor >> c._music >> c._vsync; 105 | if (c._noReset == 0 || c._lvl <= 0) { 106 | c.reset(); 107 | return is; 108 | } 109 | is >> n; 110 | for (size_t i = 0; i < n; i++) { 111 | is >> tmpInt; 112 | c.spaceships.push_back(tmpInt); 113 | } 114 | is >> n; 115 | for (size_t i = 0; i < n; i++) { 116 | is >> tmpInt; 117 | c.colors.push_back(tmpInt); 118 | } 119 | is >> n; 120 | for (size_t i = 0; i < n; i++) { 121 | is >> tmpInt; 122 | c.scores.push_back(tmpInt); 123 | } 124 | is >> n; 125 | for (size_t i = 0; i < n; i++) { 126 | is >> tmpString; 127 | c.dates.push_back(tmpString); 128 | tmpString = ""; 129 | } 130 | return is; 131 | } 132 | 133 | /* 134 | * Update configuration when you buy a spaceship 135 | */ 136 | void Config::buySpaceship(int spaceship) 137 | { 138 | if (_nbrStar>=15 && spaceship > 0 && spaceship < 9 && !spaceships[spaceship]) { 139 | _nbrStar -= 15; 140 | spaceships[spaceship] = true; 141 | } 142 | } 143 | 144 | /* 145 | * Update configuration when you buy a spaceship 146 | */ 147 | void Config::buyColor(int color) 148 | { 149 | if (_nbrStar >= 10 && color > 0 && color < 9 && !colors[color]) { 150 | _nbrStar -= 10; 151 | colors[color] = true; 152 | } 153 | } 154 | 155 | /* 156 | * Update configuration when you do a new score 157 | */ 158 | void Config::addScore(float pts) 159 | { 160 | auto time = std::time(nullptr); 161 | int score = (int)pts; 162 | int tmp; 163 | std::string tmpd; 164 | std::stringstream date; 165 | date << std::put_time(std::gmtime(&time), "%D"); 166 | if (score > 0) { 167 | scores.push_back(score); 168 | dates.push_back(date.str()); 169 | for (size_t i = 0; i < scores.size(); i++) { 170 | for (size_t j = i + 1; j < scores.size(); j++) { 171 | if (scores[j] > scores[i]) { 172 | tmp = scores[i]; 173 | scores[i] = scores[j]; 174 | scores[j] = tmp; 175 | tmpd = std::string(dates[i]); 176 | dates[i] = std::string(dates[j]); 177 | dates[j] = std::string(tmpd); 178 | } 179 | } 180 | } 181 | while (scores.size() > 10) { 182 | scores.pop_back(); 183 | dates.pop_back(); 184 | } 185 | } 186 | } 187 | 188 | //Setters and getters 189 | void Config::addNbrStar() 190 | { 191 | _nbrStar++; 192 | } 193 | 194 | void Config::addXp(float pts) 195 | { 196 | int toAdd = (int) (pts / 100.); 197 | _xp += toAdd; 198 | if (_xp >= 100) { 199 | addLvl(); 200 | _xp %= 100; 201 | } 202 | } 203 | 204 | void Config::addLvl() 205 | { 206 | if (_lvl < 100) { 207 | _lvl++; 208 | } 209 | } 210 | 211 | std::vector Config::getSpaceships() const 212 | { 213 | return std::vector(spaceships); 214 | } 215 | 216 | std::vector Config::getColors() const 217 | { 218 | return std::vector(colors); 219 | } 220 | 221 | std::vector Config::getScores() const 222 | { 223 | return std::vector(scores); 224 | } 225 | 226 | std::vector Config::getDates() const 227 | { 228 | return std::vector(dates); 229 | } 230 | 231 | int Config::getVolume() const 232 | { 233 | return _volume; 234 | } 235 | 236 | 237 | int Config::getLevel() const 238 | { 239 | return _lvl; 240 | } 241 | 242 | float Config::getXp() const 243 | { 244 | return (_xp/100.); 245 | } 246 | 247 | int Config::getNbrStar() const 248 | { 249 | return _nbrStar; 250 | } 251 | 252 | int Config::getSelectedSpaceship() const 253 | { 254 | return _sSpaceship; 255 | } 256 | 257 | int Config::getSelectedColor() const 258 | { 259 | return _sColor; 260 | } 261 | 262 | bool Config::isMusicOn() const 263 | { 264 | return _music; 265 | } 266 | 267 | bool Config::isVsyncOn() const 268 | { 269 | return _vsync; 270 | } 271 | 272 | std::string Config::getLevelString() const 273 | { 274 | std::stringstream ss; 275 | ss.width(8); 276 | ss << "Level " << _lvl; 277 | return ss.str(); 278 | } 279 | 280 | std::string Config::getNbrStarString() const 281 | { 282 | std::stringstream ss; 283 | ss.width(3); 284 | ss << _nbrStar; 285 | return ss.str(); 286 | } 287 | 288 | bool Config::setVolume(int volume) 289 | { 290 | if (volume >= 0 && volume <= 100) { 291 | _volume = volume; 292 | return true; 293 | } 294 | return false; 295 | } 296 | 297 | bool Config::setLevel(int lvl) 298 | { 299 | if (lvl > 0) { 300 | _lvl = lvl; 301 | return true; 302 | } 303 | return false; 304 | } 305 | 306 | bool Config::setNbrStar(int nbrStar) 307 | { 308 | if (nbrStar >= 0) { 309 | _nbrStar = nbrStar; 310 | return true; 311 | } 312 | return false; 313 | } 314 | 315 | void Config::setMusic(bool music) 316 | { 317 | _music = music; 318 | } 319 | 320 | void Config::setVsync(bool vsync) 321 | { 322 | _vsync = vsync; 323 | } 324 | 325 | bool Config::setSelectedSpaceship(int spaceship) 326 | { 327 | if (spaceship >= 0 && spaceship <= 8 && spaceships[spaceship]) { 328 | _sSpaceship = spaceship; 329 | return true; 330 | } 331 | return false; 332 | } 333 | 334 | bool Config::setSelectedColor(int color) 335 | { 336 | if (color >= 0 && color <= 7 && colors[_sSpaceship]) { 337 | _sColor = color; 338 | return true; 339 | } 340 | _sColor = Spaceship::SPACESHIP_COLOR_RED; 341 | return false; 342 | } 343 | 344 | std::string Config::str() { 345 | std::stringstream ss; 346 | ss << "Volume : " << _volume << std::endl; 347 | ss << "Lvl : " << _lvl << std::endl; 348 | ss << "Xp : " << _xp << std::endl; 349 | ss << "Nbr Stars : " << _nbrStar << std::endl; 350 | ss << "Music : " << _music << std::endl; 351 | ss << "Vsync : " << _vsync << std::endl; 352 | for (size_t i = 0; i < spaceships.size(); i++) { 353 | ss << "Spaceships : " << spaceships[i] << std::endl; 354 | } 355 | for (size_t i = 0; i < colors.size(); i++) { 356 | ss << "Colors : " << colors[i] << std::endl; 357 | } 358 | for (size_t i = 0; i < scores.size(); i++) { 359 | ss << "Scores : " << scores[i] << std::endl; 360 | } 361 | for (size_t i = 0; i < dates.size(); i++) { 362 | ss << "Dates : " << dates[i] << std::endl; 363 | } 364 | return ss.str(); 365 | } 366 | -------------------------------------------------------------------------------- /Config.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #pragma warning(disable:4996) 6 | #pragma once 7 | class Config 8 | { 9 | private: 10 | int _volume, _lvl, _xp, _nbrStar, _sSpaceship, _sColor; 11 | bool _noReset, _music, _vsync; 12 | std::vector spaceships; 13 | std::vector colors; 14 | std::vector scores; 15 | std::vector dates; 16 | public: 17 | Config(); 18 | ~Config(); 19 | void save(); 20 | void load(); 21 | void reset(); 22 | bool testValidity(); 23 | friend std::ostream& operator<<(std::ostream& os, const Config& c); 24 | friend std::istream& operator>>(std::istream& is, Config& c); 25 | void buySpaceship(int spaceship); 26 | void buyColor(int color); 27 | void addScore(float pts); 28 | void addNbrStar(); 29 | void addXp(float pts); 30 | void addLvl(); 31 | 32 | //Setters 33 | bool setVolume(int volume); 34 | bool setLevel(int lvl); 35 | bool setNbrStar(int nbrStar); 36 | void setMusic(bool music); 37 | void setVsync(bool vsync); 38 | bool setSelectedSpaceship(int spaceship); 39 | bool setSelectedColor(int color); 40 | std::string str(); 41 | //Getters 42 | int getVolume() const; 43 | int getLevel() const ; 44 | float getXp() const; 45 | int getNbrStar() const; 46 | int getSelectedSpaceship() const; 47 | int getSelectedColor() const; 48 | bool isMusicOn() const; 49 | bool isVsyncOn() const; 50 | //Getters vector 51 | std::vector getSpaceships() const; 52 | std::vector getColors() const; 53 | std::vector getScores() const; 54 | std::vector getDates() const; 55 | //String getters 56 | std::string getLevelString() const; 57 | std::string getNbrStarString() const; 58 | 59 | 60 | }; 61 | -------------------------------------------------------------------------------- /Credits.cpp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/Credits.cpp -------------------------------------------------------------------------------- /Credits.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyButton.h" 3 | #pragma once 4 | class Credits : public Panel 5 | { 6 | private: 7 | sf::Text ln1, ln2, ln3; 8 | sf::Font font; 9 | MyButton back; 10 | public: 11 | Credits(MyWindow* window); 12 | void init(); 13 | //Listeners 14 | int keyPressedOnce(sf::Keyboard::Key key); 15 | int keyPressed(int key); 16 | int mouseMove(int x, int y); 17 | int mouseClicked(int x, int y, sf::Mouse::Button button); 18 | //Getters 19 | int getType() const; 20 | }; 21 | 22 | -------------------------------------------------------------------------------- /Ennemy.cpp: -------------------------------------------------------------------------------- 1 | #include "Ennemy.h" 2 | #include 3 | #include 4 | 5 | /* 6 | * Constructor 7 | */ 8 | Ennemy::Ennemy(int minX, int minY, int y) 9 | { 10 | //Init variables 11 | _health = 2; 12 | _direction = y % 2; 13 | int skinType = y % 5; 14 | //Sprite loading 15 | std::stringstream ss; 16 | ss << "images/obstacles/ennemy" << skinType << ".png"; 17 | if (!texture.loadFromFile(ss.str())) {}; 18 | sprite = sf::Sprite(texture); 19 | //Set position out of screen 20 | int posX = minX + texture.getSize().x; 21 | int posY = y % (minY - texture.getSize().y); // random % (window size - ennemy size) avoid out of window spawn 22 | sprite.setPosition(posX, posY); 23 | //Set type 24 | _type = Obstacle::TYPE_ENNEMY; 25 | } 26 | 27 | /* 28 | * Destructor 29 | */ 30 | Ennemy::~Ennemy() 31 | { 32 | } 33 | 34 | /* 35 | * Move the ennemy with a speed and with a direction 36 | */ 37 | void Ennemy::move(float speed) 38 | { 39 | sprite.move(-speed, 0); 40 | if (_direction && (sprite.getPosition().y - speed/2) > 0) { 41 | sprite.move(0, -5); 42 | } 43 | else { 44 | _direction = false; 45 | } 46 | if (!_direction && (sprite.getPosition().y + texture.getSize().y + speed/2) < 810) { 47 | sprite.move(0, +5); 48 | } 49 | else { 50 | _direction = true; 51 | } 52 | } 53 | 54 | /* 55 | * Remove health when a ennemy is hit 56 | */ 57 | bool Ennemy::takeDamage() 58 | { 59 | _health -= 1; 60 | if (_health <= 0) { 61 | return false; 62 | } 63 | return true; 64 | } 65 | -------------------------------------------------------------------------------- /Ennemy.h: -------------------------------------------------------------------------------- 1 | #include "Obstacle.h" 2 | #include 3 | #pragma once 4 | class Ennemy : public Obstacle 5 | { 6 | private: 7 | bool _direction; 8 | public: 9 | Ennemy(int minX, int minY, int y); 10 | ~Ennemy(); 11 | void move(float speed); 12 | bool takeDamage(); 13 | }; 14 | 15 | -------------------------------------------------------------------------------- /Game.cpp: -------------------------------------------------------------------------------- 1 | #include "Game.h" 2 | #include 3 | #include 4 | #include 5 | 6 | Game::Game(MyWindow* window) : Panel(window) 7 | { 8 | //Init buttons 9 | srand(time(NULL)); 10 | //Pause 11 | if (!pauseMenu.loadFromFile("images/game/menu_pause.png")) {}; 12 | if (!font.loadFromFile("fonts/masterbreaker.ttf")) {} 13 | if (!health.loadFromFile("images/game/health.png")) {}; 14 | if (!bonus.loadFromFile("images/game/bonus.png")) {}; 15 | if (!score.loadFromFile("images/game/score.png")) {}; 16 | if (!game_over.loadFromFile("images/game/gameover.png")) {}; 17 | if (!game_over_off.create(game_over.getSize().x, game_over.getSize().y)) {}; 18 | 19 | _restart = MyButton("images/game/restart.png", "images/game/restart_s.png"); 20 | _restart.changeTexture(false); 21 | btnMenu = MyButton("images/game/btn_menu.png", "images/game/btn_menu_s.png"); 22 | btnQuit = MyButton("images/game/btn_quit.png", "images/game/btn_quit_s.png"); 23 | 24 | _pauseMenu = sf::Sprite(pauseMenu); 25 | int skinType = getWindow()->getConfig()->getSelectedSpaceship(); 26 | int colorType = getWindow()->getConfig()->getSelectedColor(); 27 | spaceship = new Spaceship(skinType, colorType); 28 | 29 | //Init sound 30 | if (!buffer.loadFromFile("sounds/laser.wav")) {} 31 | sound.setBuffer(buffer); 32 | 33 | restart(); 34 | } 35 | 36 | Game::~Game() 37 | { 38 | for (size_t i = 0; i < obstacles.size(); i++) { 39 | delete obstacles[i]; 40 | } 41 | delete spaceship; 42 | } 43 | 44 | void::Game::restart() { 45 | //Init variables 46 | _ticks = _laserTicks = _pts = 0; 47 | _typeBonus = -1; 48 | _timeBonus = 0; 49 | _speed = 12; 50 | _pause = false; 51 | lasers.clear(); 52 | obstacles.clear(); 53 | //Game 54 | pts = sf::Text(" 0", font, 72); 55 | pts.setFillColor(sf::Color(249, 148, 7)); 56 | 57 | rectHealth = sf::RectangleShape(sf::Vector2f(275, 51)); 58 | rectHealth.setFillColor(sf::Color(195, 2, 2)); 59 | rectHealth.setPosition(15, 60); 60 | rectBonus = sf::RectangleShape(sf::Vector2f(0, 120)); 61 | rectBonus.setFillColor(sf::Color(249, 148, 7, 51)); 62 | rectBonus.setPosition(17, 672); 63 | 64 | _bonus = sf::Sprite(bonus); 65 | _health = sf::Sprite(health); 66 | _game_over = sf::Sprite(game_over); 67 | _score = sf::Sprite(score); 68 | _tbonus = sf::Sprite(tbonus); 69 | 70 | //Spaceship 71 | int skinType = getWindow()->getConfig()->getSelectedSpaceship(); 72 | int colorType = getWindow()->getConfig()->getSelectedColor(); 73 | *spaceship = Spaceship(skinType, colorType); 74 | spaceship->setSkin(skinType, colorType); 75 | 76 | //Set position 77 | _pauseMenu.setPosition(590, 337); 78 | _health.setPosition(5, 11); 79 | _bonus.setPosition(4, 622); 80 | _score.setPosition(1270, 694); 81 | _game_over.setPosition(405, 190); 82 | pts.setPosition(1230, 710); 83 | _restart.setPosition(1343, 13); 84 | btnMenu.setPosition(629, 363); 85 | btnQuit.setPosition(647, 430); 86 | btnMenu.changeTexture(false); 87 | btnQuit.changeTexture(false); 88 | spaceship->setPosition(27, ((getWindow()->getSize().y - spaceship->getHeight()) / 2.)); 89 | 90 | //Set todos 91 | btnMenu.setToDo(Panel::PANEL_MENU); 92 | } 93 | 94 | void Game::init() 95 | { 96 | //Speed algo 97 | if (!_pause) { 98 | _pts += 0.1; 99 | _speed += 0.00032; 100 | std::stringstream ss; 101 | ss.width(8); 102 | ss << (int)_pts; 103 | pts.setString(ss.str()); 104 | } 105 | if (_speed >= _timeBonus) { 106 | _typeBonus = -1; 107 | } 108 | //Skin settings changed 109 | if (spaceship->getSkin() != getWindow()->getConfig()->getSelectedSpaceship() || spaceship->getColor() != getWindow()->getConfig()->getSelectedColor()) { 110 | restart(); 111 | } 112 | //Bonus changed 113 | if (!tbonus.loadFromFile(Bonus::getBonusSprite(_typeBonus))) {}; 114 | _tbonus = sf::Sprite(tbonus); 115 | _tbonus.setPosition(17, 672); 116 | if (_typeBonus != -1) { 117 | rectBonus.setSize(sf::Vector2f(((_timeBonus - _speed) / 0.24 * 120), 120)); 118 | } 119 | else { 120 | rectBonus.setSize(sf::Vector2f(0, 120)); 121 | } 122 | //Settings 123 | _restart.setVolume(getWindow()->getConfig()->getVolume()); 124 | btnMenu.setVolume(getWindow()->getConfig()->getVolume()); 125 | btnQuit.setVolume(getWindow()->getConfig()->getVolume()); 126 | sound.setVolume(getWindow()->getConfig()->getVolume()); 127 | //Draw sprites 128 | getWindow()->clear(); 129 | rectHealth.setSize(sf::Vector2f((275 * (spaceship->getHealth() / spaceship->getMaxHealth())), 51)); 130 | getWindow()->draw(getBackground()); 131 | manageShoots(); 132 | manageObstacles(); 133 | getWindow()->draw(spaceship->getSprite()); 134 | getWindow()->draw(pts); 135 | getWindow()->draw(rectHealth); 136 | getWindow()->draw(_health); 137 | getWindow()->draw(rectBonus); 138 | getWindow()->draw(_tbonus); 139 | getWindow()->draw(_bonus); 140 | getWindow()->draw(_score); 141 | getWindow()->draw(_restart.getSprite()); 142 | //Paused 143 | if (_pause) { 144 | _ticks++; 145 | getWindow()->draw(_pauseMenu); 146 | getWindow()->draw(btnMenu.getSprite()); 147 | getWindow()->draw(btnQuit.getSprite()); 148 | if (spaceship->getHealth() <= 0) { 149 | getWindow()->draw(_game_over); 150 | } 151 | if (_ticks >= 30) { 152 | _game_over.setTexture(game_over); 153 | } 154 | if (_ticks >= 60) { 155 | _game_over.setTexture(game_over_off); 156 | _ticks = 0; 157 | } 158 | } 159 | } 160 | 161 | void Game::shoot() 162 | { 163 | int lspeed; 164 | (_typeBonus == Bonus::BONUS_TYPE_SPEED) ? lspeed = 5 : lspeed = 10; 165 | if (_laserTicks > lspeed) { 166 | lasers.push_back(Laser((spaceship->getX()+spaceship->getGuns().x), (spaceship->getY()+spaceship->getGuns().y), Bonus::getColorLaser(_typeBonus))); 167 | if(spaceship->hasDoubleGun()) { 168 | lasers.push_back(Laser((spaceship->getX() + spaceship->getGuns().x), (spaceship->getY() + spaceship->getGuns().z), Bonus::getColorLaser(_typeBonus))); 169 | _laserTicks = -lspeed; 170 | } 171 | else { 172 | _laserTicks = 0; 173 | } 174 | sound.play(); 175 | } 176 | } 177 | 178 | void Game::pause() 179 | { 180 | _pause = !_pause; 181 | } 182 | 183 | void Game::manageObstacles() { 184 | int chance; 185 | if (!_pause) { 186 | _ticks++; 187 | //Obstacles spawning 188 | if (_ticks > 40) { 189 | chance = rand() % 100; 190 | if (chance < 40) { 191 | obstacles.push_back(new Meteor(getWindow()->getSize().x + 300, getWindow()->getSize().y, rand())); 192 | } 193 | else if (chance < 82) { 194 | obstacles.push_back(new Ennemy(getWindow()->getSize().x + 300, getWindow()->getSize().y, rand())); 195 | } 196 | else if (chance < 94) { 197 | obstacles.push_back(new Star(getWindow()->getSize().x + 300, getWindow()->getSize().y, rand())); 198 | } 199 | else { 200 | obstacles.push_back(new Bonus(getWindow()->getSize().x + 300, getWindow()->getSize().y, rand())); 201 | } 202 | _ticks = 0; 203 | } 204 | //Obstacles management 205 | for (size_t i = 0; i < obstacles.size(); i++) 206 | { 207 | //Out of bounds 208 | if (obstacles[i]->getSprite().getPosition().x < -obstacles[i]->getSprite().getGlobalBounds().width || obstacles[i]->getSprite().getPosition().y < -obstacles[i]->getSprite().getGlobalBounds().height) 209 | { 210 | obstacles.erase(obstacles.begin() + i); 211 | } 212 | //Collisions obstacles >< spaceship 213 | else if (obstacles[i]->getSprite().getGlobalBounds().intersects(spaceship->getSprite().getGlobalBounds())) 214 | { 215 | // Meteor OR Ennemy >< Spaceship 216 | if ((obstacles[i]->getType() == Obstacle::TYPE_METEOR) || (obstacles[i]->getType() == Obstacle::TYPE_ENNEMY)) { 217 | if(_typeBonus != Bonus::BONUS_TYPE_GOD) spaceship->takeDamages(); 218 | //Game over 219 | if (spaceship->getHealth() <= 0) { 220 | getWindow()->getConfig()->addScore(_pts); 221 | getWindow()->getConfig()->addXp(_pts); 222 | pause(); 223 | } 224 | } 225 | // Star >< Spaceship 226 | else if (obstacles[i]->getType() == Obstacle::TYPE_STAR) { 227 | getWindow()->getConfig()->addNbrStar(); 228 | } 229 | // Bonus >< Spaceship 230 | else if (obstacles[i]->getType() == Obstacle::TYPE_BONUS) { 231 | if (obstacles[i]->getBonus() == Bonus::BONUS_TYPE_HEAL) { 232 | spaceship->addHealth(); 233 | } 234 | else if (_typeBonus == -1 && _speed >= _timeBonus) { 235 | _typeBonus = obstacles[i]->getBonus(); 236 | _timeBonus = _speed + 0.24; 237 | } 238 | } 239 | //Delete it 240 | obstacles.erase(obstacles.begin() + i); 241 | break; 242 | } 243 | } 244 | } 245 | for (size_t i = 0; i < obstacles.size(); i++) 246 | { 247 | if (!_pause) obstacles[i]->move(_speed); 248 | getWindow()->draw(obstacles[i]->getSprite()); 249 | } 250 | } 251 | 252 | void Game::manageShoots() 253 | { 254 | if (!_pause) { 255 | _laserTicks++; 256 | for (size_t i = 0; i < lasers.size(); i++) 257 | { 258 | //Out of bounds 259 | if (lasers[i].getSprite().getPosition().x < 0 || lasers[i].getSprite().getPosition().x > getWindow()->getSize().x 260 | || lasers[i].getSprite().getPosition().y < 0 || lasers[i].getSprite().getPosition().y > getWindow()->getSize().y) 261 | { 262 | lasers.erase(lasers.begin() + i); 263 | } 264 | //Lasers management 265 | else 266 | { 267 | for (size_t k = 0; k < obstacles.size(); k++) 268 | { 269 | if (lasers[i].getSprite().getGlobalBounds().intersects(obstacles[k]->getSprite().getGlobalBounds())) 270 | { 271 | // Laser >< Metor OR Ennemy 272 | if ((obstacles[k]->getType() == Obstacle::TYPE_ENNEMY) || (_typeBonus == Bonus::BONUS_TYPE_METEOR && obstacles[k]->getType() == Obstacle::TYPE_METEOR)) { 273 | //Ennemy destroyed 274 | if (_typeBonus == Bonus::BONUS_TYPE_DAMAGE) { 275 | if (obstacles[k]->getType() == Obstacle::TYPE_ENNEMY) _pts += 150; 276 | obstacles.erase(obstacles.begin() + k); 277 | } 278 | else if (!obstacles[k]->takeDamage()) { 279 | if (obstacles[k]->getType() == Obstacle::TYPE_ENNEMY) _pts += 150; 280 | obstacles.erase(obstacles.begin() + k); 281 | } 282 | } 283 | lasers.erase(lasers.begin() + i); 284 | break; 285 | } 286 | } 287 | } 288 | } 289 | } 290 | for (size_t i = 0; i < lasers.size(); i++) 291 | { 292 | lasers[i].setSprite(); 293 | if(!_pause) lasers[i].move(); 294 | getWindow()->draw(lasers[i].getSprite()); 295 | } 296 | } 297 | 298 | int Game::keyPressed(int key) 299 | { 300 | switch (key) { 301 | case(sf::Keyboard::Key::Space): if(!_pause) shoot(); break; 302 | case(sf::Keyboard::Key::Z): 303 | if (!_pause && spaceship->getY()-10 > 0) 304 | spaceship->move(0,-1); 305 | break; 306 | case(sf::Keyboard::Key::S): 307 | if (!_pause && (spaceship->getY() + spaceship->getHeight()+10) < getWindow()->getSize().y ) 308 | spaceship->move(0, 1); 309 | break; 310 | case(sf::Keyboard::Key::Q): 311 | if (!_pause &&spaceship->getX()-10 > 0) 312 | spaceship->move(-1, 0); 313 | break; 314 | case(sf::Keyboard::Key::D): 315 | if (!_pause && (spaceship->getX() + spaceship->getWidth()+10) < (getWindow()->getSize().x) ) 316 | spaceship->move(1, 0); 317 | break; 318 | case(sf::Keyboard::Key::R): 319 | restart(); 320 | break; 321 | } 322 | return -1; 323 | } 324 | 325 | void Game::moveBackground() 326 | { 327 | if (!_pause) { 328 | Panel::moveBackground(); 329 | } 330 | } 331 | int Game::keyPressedOnce(sf::Keyboard::Key key) 332 | { 333 | switch (key) { 334 | case(sf::Keyboard::Key::Escape): if (spaceship->getHealth() > 0) pause(); break; 335 | } 336 | return -1; 337 | } 338 | 339 | 340 | int Game::mouseClicked(int x, int y, sf::Mouse::Button button) 341 | { 342 | if (button == sf::Mouse::Button::Left) { 343 | if (btnMenu.isSelected(x, y)) { 344 | pause(); 345 | restart(); 346 | return btnMenu.toDo(); 347 | } 348 | else if (_restart.isSelected(x, y)) { 349 | restart(); 350 | } 351 | else if (btnQuit.isSelected(x, y)) { 352 | getWindow()->getConfig()->save(); 353 | getWindow()->close(); 354 | } 355 | } 356 | return -1; 357 | } 358 | 359 | int Game::mouseMove(int x, int y) { 360 | if (btnMenu.isSelected(x, y) && _pause) { 361 | btnMenu.changeTexture(); 362 | } 363 | else if (btnQuit.isSelected(x, y) && _pause) { 364 | btnQuit.changeTexture(); 365 | } 366 | else if (_restart.isSelected(x, y)) { 367 | _restart.changeTexture(); 368 | } 369 | return -1; 370 | } 371 | 372 | int Game::getType() const 373 | { 374 | return Panel::PANEL_GAME; 375 | } 376 | 377 | 378 | -------------------------------------------------------------------------------- /Game.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "Laser.h" 3 | #include "Meteor.h" 4 | #include "Star.h" 5 | #include "Bonus.h" 6 | #include "Ennemy.h" 7 | #include "MyButton.h" 8 | #include "Spaceship.h" 9 | #pragma once 10 | class Game : public Panel 11 | { 12 | private: 13 | bool _pause; 14 | int _ticks, _laserTicks, _typeBonus; 15 | float _pts, _speed, _timeBonus; 16 | MyButton btnMenu, btnQuit, _restart; 17 | Spaceship* spaceship; 18 | sf::Font font; 19 | sf::Text pts; 20 | sf::Texture pauseMenu, health, bonus, score, game_over, game_over_off, tbonus; 21 | sf::Sprite _pauseMenu, _health, _bonus, _score, _game_over, _tbonus; 22 | sf::RectangleShape rectHealth, rectBonus; 23 | std::vector lasers; 24 | std::vector obstacles; 25 | sf::SoundBuffer buffer; 26 | sf::Sound sound; 27 | public: 28 | Game(MyWindow* window); 29 | ~Game(); 30 | void init(); 31 | void shoot(); 32 | void pause(); 33 | void restart(); 34 | void manageShoots(); 35 | void manageObstacles(); 36 | //Listeners 37 | int keyPressed(int key); 38 | int keyPressedOnce(sf::Keyboard::Key key); 39 | void moveBackground(); 40 | int mouseClicked(int x, int y, sf::Mouse::Button button); 41 | int mouseMove(int x, int y); 42 | //Getters 43 | int getType() const; 44 | }; 45 | 46 | -------------------------------------------------------------------------------- /Laser.cpp: -------------------------------------------------------------------------------- 1 | #include "Laser.h" 2 | #include 3 | 4 | /* 5 | * Default constructor 6 | */ 7 | Laser::Laser(int x, int y) : Laser(x, y, Laser::LASER_TYPE_BLUE) 8 | { 9 | } 10 | 11 | /* 12 | * Constructor 13 | */ 14 | Laser::Laser(int x, int y, int type) 15 | { 16 | std::string path; 17 | switch (type) { 18 | case Laser::LASER_TYPE_GREEN: 19 | path = "images/lasers/green.png"; 20 | _type = Laser::LASER_TYPE_GREEN; break; 21 | case Laser::LASER_TYPE_RED: 22 | path = "images/lasers/red.png"; 23 | _type = Laser::LASER_TYPE_RED; break; 24 | case Laser::LASER_TYPE_YELLOW: 25 | path = "images/lasers/yellow.png"; 26 | _type = Laser::LASER_TYPE_YELLOW; break; 27 | default: 28 | path = "images/lasers/blue.png"; 29 | _type = Laser::LASER_TYPE_BLUE; break; 30 | } 31 | if (!texture.loadFromFile(path)) {}; 32 | sprite = sf::Sprite(texture); 33 | sprite.setPosition(x, y); 34 | } 35 | 36 | /* 37 | * Destructor 38 | */ 39 | Laser::~Laser() 40 | { 41 | } 42 | 43 | /* 44 | * Move the laser with a constant speed 45 | */ 46 | void Laser::move() 47 | { 48 | sprite.move(20, 0); 49 | } 50 | 51 | /* 52 | * Set the laser sprite 53 | */ 54 | void Laser::setSprite() { 55 | sprite.setTexture(texture); 56 | } 57 | 58 | /* 59 | * Get the laser type 60 | */ 61 | int Laser::getType() const 62 | { 63 | return _type; 64 | } 65 | 66 | /* 67 | * Get the laser sprite 68 | */ 69 | sf::Sprite Laser::getSprite() const 70 | { 71 | return sf::Sprite(sprite); 72 | } 73 | -------------------------------------------------------------------------------- /Laser.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #pragma once 4 | class Laser 5 | { 6 | private: 7 | sf::Texture texture; 8 | sf::Sprite sprite; 9 | int _type; 10 | public: 11 | enum { 12 | LASER_TYPE_BLUE, 13 | LASER_TYPE_RED, 14 | LASER_TYPE_GREEN, 15 | LASER_TYPE_YELLOW 16 | }; 17 | Laser(int x, int y); 18 | Laser(int x, int y, int type); 19 | ~Laser(); 20 | void move(); 21 | void setSprite(); 22 | int getType() const; 23 | sf::Sprite getSprite() const; 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /Menu.cpp: -------------------------------------------------------------------------------- 1 | #include "Menu.h" 2 | #include 3 | 4 | Menu::Menu(MyWindow* window) : Panel(window) 5 | { 6 | //Set buttons 7 | btnPlay = new MyButton("images/menu/btn_play.png","images/menu/btn_play_s.png"); 8 | btnSettings = new MyButton("images/menu/btn_settings.png", "images/menu/btn_settings_s.png"); 9 | btnShop = new MyButton("images/menu/btn_shop.png", "images/menu/btn_shop_s.png"); 10 | btnScore = new MyButton("images/menu/btn_score.png", "images/menu/btn_score_s.png"); 11 | btnAccount = new MyButton("images/menu/btn_account.png", "images/menu/btn_account_s.png"); 12 | btnCredits = new MyButton("images/menu/btn_credits.png", "images/menu/btn_credits_s.png"); 13 | 14 | //Set positions 15 | btnPlay->setPosition(439, 112); 16 | btnSettings->setPosition(439, 220); 17 | btnShop->setPosition(439, 323); 18 | btnScore->setPosition(439, 431); 19 | btnAccount->setPosition(432, 540); 20 | btnCredits->setPosition(433, 647); 21 | 22 | //Set todos 23 | btnPlay->setToDo(Panel::PANEL_GAME); 24 | btnSettings->setToDo(Panel::PANEL_SETTINGS); 25 | btnShop->setToDo(Panel::PANEL_SHOP); 26 | btnScore->setToDo(Panel::PANEL_SCORE); 27 | btnAccount->setToDo(Panel::PANEL_ACCOUNT); 28 | btnCredits->setToDo(Panel::PANEL_CREDITS); 29 | 30 | } 31 | 32 | Menu::~Menu() 33 | { 34 | delete btnPlay; 35 | delete btnSettings; 36 | delete btnScore; 37 | delete btnShop; 38 | delete btnAccount; 39 | delete btnCredits; 40 | } 41 | 42 | void Menu::init() 43 | { 44 | //Set volume 45 | btnPlay->setVolume(getWindow()->getConfig()->getVolume()); 46 | btnSettings->setVolume(getWindow()->getConfig()->getVolume()); 47 | btnShop->setVolume(getWindow()->getConfig()->getVolume()); 48 | btnScore->setVolume(getWindow()->getConfig()->getVolume()); 49 | btnAccount->setVolume(getWindow()->getConfig()->getVolume()); 50 | btnCredits->setVolume(getWindow()->getConfig()->getVolume()); 51 | getWindow()->clear(); 52 | //Draw sprites 53 | getWindow()->draw(getBackground()); 54 | getWindow()->draw(btnPlay->getSprite()); 55 | getWindow()->draw(btnSettings->getSprite()); 56 | getWindow()->draw(btnShop->getSprite()); 57 | getWindow()->draw(btnScore->getSprite()); 58 | getWindow()->draw(btnAccount->getSprite()); 59 | getWindow()->draw(btnCredits->getSprite()); 60 | } 61 | 62 | int Menu::mouseClicked(int x, int y, sf::Mouse::Button button) 63 | { 64 | if (button == sf::Mouse::Button::Left) { 65 | if (btnPlay->isSelected(x, y)) { 66 | btnPlay->changeTexture(false); 67 | return btnPlay->toDo(); 68 | } 69 | else if (btnSettings->isSelected(x, y)) { 70 | btnSettings->changeTexture(false); 71 | return btnSettings->toDo(); 72 | } 73 | else if (btnShop->isSelected(x, y)) { 74 | btnShop->changeTexture(false); 75 | return btnShop->toDo(); 76 | } 77 | else if (btnScore->isSelected(x, y)) { 78 | btnScore->changeTexture(false); 79 | return btnScore->toDo(); 80 | } 81 | else if (btnAccount->isSelected(x, y)) { 82 | btnAccount->changeTexture(false); 83 | return btnAccount->toDo(); 84 | } 85 | else if (btnCredits->isSelected(x, y)) { 86 | btnCredits->changeTexture(false); 87 | return btnCredits->toDo(); 88 | } 89 | } 90 | return -1; 91 | } 92 | 93 | int Menu::mouseMove(int x, int y) { 94 | if (btnPlay->isSelected(x, y)) { 95 | btnPlay->changeTexture(); 96 | } 97 | else if (btnSettings->isSelected(x, y)) { 98 | btnSettings->changeTexture(); 99 | } 100 | else if (btnShop->isSelected(x, y)) { 101 | btnShop->changeTexture(); 102 | } 103 | else if (btnScore->isSelected(x, y)) { 104 | btnScore->changeTexture(); 105 | } 106 | else if (btnAccount->isSelected(x, y)) { 107 | btnAccount->changeTexture(); 108 | } 109 | else if (btnCredits->isSelected(x, y)) { 110 | btnCredits->changeTexture(); 111 | } 112 | return -1; 113 | } 114 | 115 | int Menu::getType() const { 116 | return Panel::PANEL_MENU; 117 | } 118 | -------------------------------------------------------------------------------- /Menu.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyButton.h" 3 | #include 4 | #pragma once 5 | class Menu : public Panel 6 | { 7 | private: 8 | MyButton *btnPlay, *btnSettings, *btnScore, *btnShop, *btnAccount, *btnCredits; 9 | public: 10 | Menu(MyWindow* window); 11 | ~Menu(); 12 | void init(); 13 | //Listeners 14 | int mouseClicked(int x, int y, sf::Mouse::Button button); 15 | int mouseMove(int x, int y); 16 | //Getters 17 | int getType() const; 18 | }; 19 | 20 | -------------------------------------------------------------------------------- /Meteor.cpp: -------------------------------------------------------------------------------- 1 | #include "Meteor.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | 7 | /* 8 | * Constructor 9 | */ 10 | Meteor::Meteor(int minX, int minY, int y) 11 | { 12 | //Skin random generator 13 | int skinType = y % 3; 14 | _health = 2; 15 | //Sprite loading 16 | std::stringstream ss; 17 | ss << "images/obstacles/meteor" << skinType << ".png"; 18 | if (!texture.loadFromFile(ss.str())) {}; 19 | sprite = sf::Sprite(texture); 20 | //Set position out of screen 21 | int posX = minX + texture.getSize().x; 22 | int posY = y % (minY-texture.getSize().y); 23 | sprite.setPosition(posX, posY); 24 | //Set type 25 | _type = Obstacle::TYPE_METEOR; 26 | } 27 | 28 | /* 29 | * Destructor 30 | */ 31 | Meteor::~Meteor() 32 | { 33 | } 34 | 35 | /* 36 | * Remove health when the meteor is hit 37 | */ 38 | bool Meteor::takeDamage() 39 | { 40 | _health -= 1; 41 | if (_health <= 0) { 42 | return false; 43 | } 44 | return true; 45 | } 46 | -------------------------------------------------------------------------------- /Meteor.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Obstacle.h" 3 | #include 4 | #pragma once 5 | class Meteor : public Obstacle 6 | { 7 | public: 8 | Meteor(int minX, int minY, int y); 9 | ~Meteor(); 10 | bool takeDamage(); 11 | }; 12 | 13 | -------------------------------------------------------------------------------- /MyButton.cpp: -------------------------------------------------------------------------------- 1 | #include "MyButton.h" 2 | #include 3 | 4 | /* 5 | * Constructor 6 | */ 7 | MyButton::MyButton(std::string path) 8 | { 9 | if (!buffer.loadFromFile("sounds/button.wav")) {} 10 | sound.setBuffer(buffer); 11 | sound.setVolume(70); 12 | texture = sf::Texture(); 13 | if (!texture.loadFromFile(path)) {}; 14 | sprite = sf::Sprite(texture); 15 | } 16 | 17 | /* 18 | * Advanced Constructor 19 | */ 20 | MyButton::MyButton(std::string path, std::string pathSelected) 21 | { 22 | if (!buffer.loadFromFile("sounds/button.wav")) {} 23 | sound.setBuffer(buffer); 24 | if (!texture.loadFromFile(path)) {}; 25 | if (!selectedTexture.loadFromFile(pathSelected)) {}; 26 | sprite = sf::Sprite(texture); 27 | } 28 | 29 | /* 30 | * Destructor 31 | */ 32 | MyButton::~MyButton() 33 | { 34 | } 35 | 36 | /* 37 | * Change texture when button is selected for example 38 | */ 39 | void MyButton::changeTexture(bool selected) { 40 | if (selected) { 41 | sprite.setTexture(selectedTexture); 42 | _isSelected = true; 43 | } 44 | else { 45 | sprite.setTexture(texture); 46 | _isSelected = false; 47 | } 48 | } 49 | 50 | /* 51 | * Change texture when button is selected for example 52 | */ 53 | void MyButton::changeTexture() { 54 | sprite.setTexture(selectedTexture); 55 | if (!_isSelected) { 56 | sound.play(); 57 | } 58 | _isSelected = true; 59 | } 60 | 61 | //Setter and getters 62 | void MyButton::setPosition(int x, int y) 63 | { 64 | sprite.setPosition(x, y); 65 | } 66 | 67 | void MyButton::setToDo(int todo) 68 | { 69 | _toDo = todo; 70 | } 71 | 72 | void MyButton::setVolume(int volume) 73 | { 74 | if (volume >= 0 && volume <= 100) { 75 | sound.setVolume(volume); 76 | } 77 | } 78 | 79 | bool MyButton::isSelected(int x, int y) 80 | { 81 | if (sprite.getGlobalBounds().contains(x, y)) { 82 | return true; 83 | } 84 | else if (_isSelected) { 85 | sprite.setTexture(texture); 86 | _isSelected = false; 87 | return false; 88 | } 89 | else { 90 | return false; 91 | } 92 | } 93 | 94 | sf::Sprite MyButton::getSprite() const 95 | { 96 | return sf::Sprite(sprite); 97 | } 98 | 99 | int MyButton::getX() const 100 | { 101 | return sprite.getPosition().x; 102 | } 103 | 104 | int MyButton::getY() const 105 | { 106 | return sprite.getPosition().y; 107 | } 108 | 109 | int MyButton::toDo() const 110 | { 111 | return _toDo; 112 | } 113 | -------------------------------------------------------------------------------- /MyButton.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #pragma once 4 | class MyButton 5 | { 6 | private: 7 | bool _isSelected=false; 8 | int _toDo; 9 | sf::Texture texture, selectedTexture; 10 | sf::Sprite sprite; 11 | sf::SoundBuffer buffer; 12 | sf::Sound sound; 13 | public: 14 | MyButton() {}; 15 | MyButton(std::string path); 16 | MyButton(std::string path, std::string pathSelected); 17 | ~MyButton(); 18 | void changeTexture(bool selected); 19 | void changeTexture(); 20 | bool isSelected(int x, int y); 21 | //Setters 22 | void setPosition(int x, int y); 23 | void setToDo(int todo); 24 | void setVolume(int volume); 25 | //Getters 26 | sf::Sprite getSprite() const; 27 | int getX() const; 28 | int getY() const; 29 | int toDo() const; 30 | }; 31 | 32 | -------------------------------------------------------------------------------- /MyCheckbox.cpp: -------------------------------------------------------------------------------- 1 | #include "MyCheckbox.h" 2 | #include 3 | 4 | /* 5 | * Constructor 6 | */ 7 | MyCheckbox::MyCheckbox() 8 | { 9 | if (!texture.loadFromFile("images/settings/checkbox.png")) {}; 10 | if (!checkTexture.loadFromFile("images/settings/checkbox_s.png")) {}; 11 | sprite = sf::Sprite(texture); 12 | } 13 | 14 | /* 15 | * Destructor 16 | */ 17 | MyCheckbox::~MyCheckbox() 18 | { 19 | } 20 | 21 | //Setters and getters 22 | void MyCheckbox::setPosition(int x, int y) 23 | { 24 | sprite.setPosition(x, y); 25 | } 26 | 27 | bool MyCheckbox::setChecked(int x, int y) 28 | { 29 | if (sprite.getGlobalBounds().contains(x, y)) { 30 | return true; 31 | } 32 | return false; 33 | } 34 | 35 | void MyCheckbox::setChecked(bool checked) { 36 | if (checked) { 37 | sprite.setTexture(checkTexture); 38 | } 39 | else { 40 | sprite.setTexture(texture); 41 | } 42 | _checked = checked; 43 | } 44 | 45 | sf::Sprite MyCheckbox::getSprite() const 46 | { 47 | return sf::Sprite(sprite); 48 | } 49 | 50 | 51 | bool MyCheckbox::isChecked() const 52 | { 53 | return _checked; 54 | } 55 | 56 | int MyCheckbox::getX() const 57 | { 58 | return sprite.getPosition().x; 59 | } 60 | 61 | int MyCheckbox::getY() const 62 | { 63 | return sprite.getPosition().y; 64 | } 65 | -------------------------------------------------------------------------------- /MyCheckbox.h: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma once 3 | class MyCheckbox 4 | { 5 | private: 6 | bool _checked; 7 | sf::Texture texture, checkTexture; 8 | sf::Sprite sprite; 9 | public: 10 | MyCheckbox(); 11 | ~MyCheckbox(); 12 | //Setters 13 | void setPosition(int x, int y); 14 | bool setChecked(int x, int y); 15 | void setChecked(bool checked); 16 | //Getters 17 | sf::Sprite getSprite() const; 18 | bool isChecked() const; 19 | int getX() const; 20 | int getY() const; 21 | }; 22 | 23 | -------------------------------------------------------------------------------- /MyProgressBar.cpp: -------------------------------------------------------------------------------- 1 | #include "MyProgressBar.h" 2 | 3 | /* 4 | * Constructor 5 | */ 6 | MyProgressBar::MyProgressBar(std::string path) 7 | { 8 | if (!texture.loadFromFile(path)) {}; 9 | sprite = sf::Sprite(texture); 10 | if (!rectTexture.loadFromFile("images/settings/rect_bar.png")) {}; 11 | rectSprite = sf::Sprite(rectTexture); 12 | _percentage = 50; 13 | _start = 0; 14 | _end = 100; 15 | } 16 | 17 | /* 18 | * Advanced constructor 19 | */ 20 | MyProgressBar::MyProgressBar(int start, int end, std::string path) : MyProgressBar(path) 21 | { 22 | _start = start; 23 | _end = end; 24 | } 25 | 26 | /* 27 | * Destructor 28 | */ 29 | MyProgressBar::~MyProgressBar() 30 | { 31 | } 32 | 33 | //Setters and getters 34 | void MyProgressBar::setPosition(int x, int y) 35 | { 36 | rectSprite.setPosition(x, y); 37 | } 38 | 39 | void MyProgressBar::setPositionBar(int x, int y) 40 | { 41 | sprite.setPosition(x, y); 42 | } 43 | 44 | /* 45 | * Return a percentage calculated with the coordinates 46 | */ 47 | bool MyProgressBar::setPercentage(int x, int y) 48 | { 49 | if (sprite.getGlobalBounds().contains(x, y)) { 50 | rectSprite.setPosition(x, rectSprite.getPosition().y); 51 | _percentage = ((float) x - sprite.getPosition().x) / texture.getSize().x; 52 | return true; 53 | } 54 | return false; 55 | } 56 | 57 | /* 58 | * Set the percentage 59 | */ 60 | bool MyProgressBar::setPercentage(int percentage) { 61 | if (percentage>=0 && percentage<=100) { 62 | _percentage = percentage / 100.; 63 | rectSprite.setPosition((sprite.getPosition().x + texture.getSize().x*_percentage), rectSprite.getPosition().y); 64 | return true; 65 | } 66 | return false; 67 | } 68 | 69 | sf::Sprite MyProgressBar::getSprite() const 70 | { 71 | return sf::Sprite(rectSprite); 72 | } 73 | 74 | sf::Sprite MyProgressBar::getSpriteBar() const 75 | { 76 | return sf::Sprite(sprite); 77 | } 78 | 79 | int MyProgressBar::getPercentage() const 80 | { 81 | return _start + ((_end - _start)*_percentage); 82 | } 83 | 84 | int MyProgressBar::getX() const 85 | { 86 | return sprite.getPosition().x; 87 | } 88 | 89 | int MyProgressBar::getY() const 90 | { 91 | return sprite.getPosition().y; 92 | } 93 | -------------------------------------------------------------------------------- /MyProgressBar.h: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma once 3 | class MyProgressBar 4 | { 5 | private: 6 | float _percentage; 7 | int _start, _end; 8 | sf::Texture texture, rectTexture; 9 | sf::Sprite sprite, rectSprite; 10 | public: 11 | MyProgressBar() {}; 12 | MyProgressBar(std::string path); 13 | MyProgressBar(int start, int end, std::string path); 14 | ~MyProgressBar(); 15 | void setPosition(int x, int y); 16 | void setPositionBar(int x, int y); 17 | bool setPercentage(int x, int y); 18 | bool setPercentage(int percentage); 19 | //Getters 20 | int getPercentage() const; 21 | int getX() const; 22 | int getY() const; 23 | sf::Sprite getSprite() const; 24 | sf::Sprite getSpriteBar() const; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /MyWindow.cpp: -------------------------------------------------------------------------------- 1 | #include "MyWindow.h" 2 | 3 | /* 4 | * Constructor 5 | */ 6 | MyWindow::MyWindow(sf::VideoMode mode, std::string title, int style) : sf::RenderWindow(mode, title, style) 7 | { 8 | config = new Config(); 9 | } 10 | 11 | /* 12 | * Destructor 13 | */ 14 | MyWindow::~MyWindow() 15 | { 16 | delete config; 17 | } 18 | 19 | /* 20 | * Get the current config 21 | */ 22 | Config * MyWindow::getConfig() const 23 | { 24 | return config; 25 | } 26 | -------------------------------------------------------------------------------- /MyWindow.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "Config.h" 3 | #pragma once 4 | class MyWindow : public sf::RenderWindow 5 | { 6 | private : 7 | Config* config; 8 | public: 9 | MyWindow(sf::VideoMode mode, std::string title, int style); 10 | ~MyWindow(); 11 | Config* getConfig() const; 12 | }; 13 | 14 | -------------------------------------------------------------------------------- /Obstacle.cpp: -------------------------------------------------------------------------------- 1 | #include "Obstacle.h" 2 | 3 | /* 4 | * Constructor 5 | */ 6 | Obstacle::Obstacle() 7 | { 8 | } 9 | 10 | /* 11 | * Destructor 12 | */ 13 | Obstacle::~Obstacle() 14 | { 15 | } 16 | 17 | /* 18 | * Move the obstacle with a speed 19 | */ 20 | void Obstacle::move(float speed) 21 | { 22 | sprite.move(-speed, 0); 23 | } 24 | 25 | /* 26 | * Get the obstacle type 27 | */ 28 | int Obstacle::getType() const 29 | { 30 | return _type; 31 | } 32 | 33 | /* 34 | * Set the obstacle sprite 35 | */ 36 | void Obstacle::setSprite() { 37 | sprite.setTexture(texture); 38 | } 39 | 40 | /* 41 | * Get the obstacle sprite 42 | */ 43 | sf::Sprite Obstacle::getSprite() const 44 | { 45 | return sf::Sprite(sprite); 46 | } 47 | 48 | -------------------------------------------------------------------------------- /Obstacle.h: -------------------------------------------------------------------------------- 1 | #include 2 | #pragma once 3 | class Obstacle 4 | { 5 | protected: 6 | sf::Texture texture; 7 | sf::Sprite sprite; 8 | int _type, _health; 9 | public: 10 | enum { 11 | TYPE_METEOR, 12 | TYPE_STAR, 13 | TYPE_BONUS, 14 | TYPE_ENNEMY 15 | }; 16 | Obstacle(); 17 | ~Obstacle(); 18 | virtual void move(float speed); 19 | virtual bool takeDamage() { return true; }; 20 | virtual int getBonus() const { return -1; }; 21 | //Getters 22 | int getType() const; 23 | //Setters 24 | void setSprite(); 25 | sf::Sprite getSprite() const; 26 | }; 27 | 28 | -------------------------------------------------------------------------------- /Panel.cpp: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | 3 | 4 | 5 | Panel::Panel(MyWindow* window) 6 | { 7 | mainWindow = window; 8 | if (!background.loadFromFile("images/background.png")) {}; 9 | _background = sf::Sprite(background); 10 | } 11 | 12 | void Panel::moveBackground() 13 | { 14 | _background.move(-0.5, 0); 15 | if (_background.getPosition().x == -1440) { 16 | _background.setPosition(0, 0); 17 | } 18 | } 19 | 20 | sf::Sprite Panel::getBackground() const 21 | { 22 | return sf::Sprite(_background); 23 | } 24 | 25 | MyWindow* Panel::getWindow() const 26 | { 27 | return mainWindow; 28 | } 29 | -------------------------------------------------------------------------------- /Panel.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include "MyWindow.h" 3 | #include 4 | #pragma once 5 | class Panel 6 | { 7 | private: 8 | sf::Texture background; 9 | sf::Sprite _background; 10 | MyWindow* mainWindow; 11 | public: 12 | Panel(MyWindow* window); 13 | enum { 14 | PANEL_SPLASHSCREEN, 15 | PANEL_MENU, 16 | PANEL_GAME, 17 | PANEL_SETTINGS, 18 | PANEL_SHOP, 19 | PANEL_SCORE, 20 | PANEL_ACCOUNT, 21 | PANEL_CREDITS 22 | }; 23 | void moveBackground(); 24 | virtual void blink() { return; }; 25 | virtual void init() = 0; 26 | //Listeners 27 | virtual int keyPressed(int key) { return -1; }; 28 | virtual int keyPressedOnce(sf::Keyboard::Key key) { return -1; }; 29 | virtual int mouseClicked(int x, int y, sf::Mouse::Button) { return -1; }; 30 | virtual int mouseMove(int x, int y) { return -1; }; 31 | //Getters 32 | virtual int getType() const = 0; 33 | MyWindow* getWindow() const; 34 | sf::Sprite getBackground() const; 35 | }; 36 | 37 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SpaceGO using C++ & SFML 2 | 3 | ![Screenshot](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot0.PNG?raw=true) 4 | 5 | # Introduction 6 | Watch the demo video on YouTube by clicking the image below : 7 | 8 | [![Watch the video](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot7.PNG?raw=true)](https://goo.gl/W292Zk) 9 | 10 | You'll need SFML to build and run this project. For more information, go to the official [SFML website and follow the instructions](https://www.sfml-dev.org/). 11 | 12 | Once you've installed SFML you can clone this project and build it with CMake. 13 | 14 | Tutorial using CMake here : https://www.youtube.com/watch?v=PJV3E6T7-1g 15 | 16 | I made all components by myself (buttons, checkbox, etc...). I'd be happy to see you using them in your own projects, if you want to. Don't hesitate and tell me about it! :D 17 | 18 | # Social medias 19 | 20 | - Twitter : https://twitter.com/Fromont_Sam 21 | - LinkedIn : https://www.linkedin.com/in/fromont-sam/ 22 | - YouTube : https://www.youtube.com/channel/UC6-lC8FAfAW_rlPZu4qCYvg 23 | 24 | # Panels presentation 25 | There is no panel in SFML but I keep speaking about panels when I create views with every kind of technologies. That's because my first GUIs were made with Java Swing, so don't pay attention to that. :) 26 | 27 | ## Menu panel 28 | This panel doesn't contain a lot of things but it links every other panels so that's the most important view of the game. 29 | 30 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot1.PNG?raw=true) 31 | 32 | ## Game panel 33 | Second most important panel, the game panel! I don't think I need to say more ^.^ 34 | 35 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot2.PNG?raw=true) 36 | 37 | ## Shop panel 38 | This panel allows you to buy new spaceships models and colors. You earn stars by playing the game and you can spend these starts to use the shop. 39 | 40 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot3.PNG?raw=true) 41 | 42 | ## Score panel 43 | Just a simple score history to challenge your friends! 44 | 45 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot4.PNG?raw=true) 46 | 47 | 48 | ## Account panel 49 | That's where you can choose your spaceships model and your color, you can also see some details like your stars and your level. 50 | 51 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot5.PNG?raw=true) 52 | 53 | 54 | ## Settings panel 55 | Some usual settings to ensure a positive game experience. 56 | 57 | ![alt text](https://github.com/Fromont-Sam/SpaceGO/blob/master/doc/screenshot6.PNG?raw=true) 58 | -------------------------------------------------------------------------------- /Score.cpp: -------------------------------------------------------------------------------- 1 | #include "Score.h" 2 | #include 3 | #include 4 | #include 5 | 6 | Score::Score(MyWindow* window) : Panel(window) 7 | { 8 | //Init 9 | if (!font.loadFromFile("fonts/masterbreaker.ttf")) {} 10 | if (!title.loadFromFile("images/menu/btn_score.png")) {}; 11 | if (!rank.loadFromFile("images/scoreboard/rank.png")) {}; 12 | if (!score.loadFromFile("images/scoreboard/score.png")) {}; 13 | if (!date.loadFromFile("images/scoreboard/date.png")) {}; 14 | back = new MyButton("images/settings/back.png", "images/settings/back_s.png"); 15 | 16 | _title = sf::Sprite(title); 17 | _rank = sf::Sprite(rank); 18 | _date = sf::Sprite(date); 19 | _score = sf::Sprite(score); 20 | 21 | for (size_t i = 0; i < 10; i++) { 22 | ranks.push_back(new sf::Text(getWindow()->getConfig()->getLevelString(), font, 50)); 23 | scores.push_back(new sf::Text(getWindow()->getConfig()->getLevelString(), font, 50)); 24 | dates.push_back(new sf::Text(getWindow()->getConfig()->getLevelString(), font, 50)); 25 | ranks[i]->setFillColor(sf::Color(249, 148, 7)); 26 | scores[i]->setFillColor(sf::Color(249, 148, 7)); 27 | dates[i]->setFillColor(sf::Color(249, 148, 7)); 28 | } 29 | 30 | //Init positions 31 | _title.setPosition(468,30); 32 | _rank.setPosition(331,142); 33 | _score.setPosition(636,142); 34 | _date.setPosition(1012,142); 35 | back->setPosition(23, 28); 36 | } 37 | 38 | Score::~Score() 39 | { 40 | for (size_t i = 0; i < ranks.size(); i++) { 41 | delete ranks[i]; 42 | } 43 | for (size_t i = 0; i < scores.size(); i++) { 44 | delete scores[i]; 45 | } 46 | for (size_t i = 0; i < dates.size(); i++) { 47 | delete dates[i]; 48 | } 49 | delete back; 50 | } 51 | 52 | 53 | void Score::init() 54 | { 55 | getWindow()->clear(); 56 | back->setVolume(getWindow()->getConfig()->getVolume()); 57 | getWindow()->draw(getBackground()); 58 | 59 | std::stringstream ssRank, ssScore, ssDate; 60 | for (size_t i = 0; i < 10; i++) { 61 | if (i < getWindow()->getConfig()->getScores().size()) { 62 | ssRank << "#" << i+1; 63 | ssScore << getWindow()->getConfig()->getScores()[i]; 64 | ssDate << getWindow()->getConfig()->getDates()[i]; 65 | 66 | 67 | ranks[i]->setString(ssRank.str()); 68 | scores[i]->setString(ssScore.str()); 69 | dates[i]->setString(ssDate.str()); 70 | 71 | ranks[i]->setPosition(339, 172 + (61 * i)); 72 | scores[i]->setPosition(750-scores[i]->getLocalBounds().width, 172 + (61 * i)); 73 | dates[i]->setPosition(1106 - dates[i]->getLocalBounds().width, 172 + (61 * i)); 74 | 75 | getWindow()->draw(*ranks[i]); 76 | getWindow()->draw(*scores[i]); 77 | getWindow()->draw(*dates[i]); 78 | 79 | ssRank.str(""); ssScore.str(""); ssDate.str(""); 80 | } 81 | } 82 | getWindow()->draw(_title); 83 | getWindow()->draw(_rank); 84 | getWindow()->draw(_score); 85 | getWindow()->draw(_date); 86 | getWindow()->draw(back->getSprite()); 87 | } 88 | 89 | int Score::keyPressedOnce(sf::Keyboard::Key key) 90 | { 91 | switch (key) { 92 | case(sf::Keyboard::Key::Escape): return Panel::PANEL_MENU; break; 93 | } 94 | return -1; 95 | } 96 | 97 | int Score::keyPressed(int key) 98 | { 99 | return -1; 100 | } 101 | 102 | int Score::mouseMove(int x, int y) { 103 | if (back->isSelected(x, y)) { 104 | back->changeTexture(); 105 | } 106 | return -1; 107 | } 108 | 109 | int Score::mouseClicked(int x, int y, sf::Mouse::Button button) 110 | { 111 | if (button == sf::Mouse::Button::Left) { 112 | if (back->isSelected(x, y)) { 113 | return Panel::PANEL_MENU; 114 | } 115 | } 116 | return -1; 117 | } 118 | 119 | int Score::getType() const 120 | { 121 | return Panel::PANEL_SCORE; 122 | } 123 | -------------------------------------------------------------------------------- /Score.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyButton.h" 3 | #pragma once 4 | class Score : public Panel 5 | { 6 | private: 7 | sf::Font font; 8 | sf::Texture title, rank, score, date; 9 | sf::Sprite _title, _rank, _score, _date; 10 | std::vector ranks, scores, dates; 11 | MyButton *back; 12 | public: 13 | Score(MyWindow* window); 14 | ~Score(); 15 | void init(); 16 | //Listeners 17 | int keyPressedOnce(sf::Keyboard::Key key); 18 | int keyPressed(int key); 19 | int mouseMove(int x, int y); 20 | int mouseClicked(int x, int y, sf::Mouse::Button button); 21 | //Getters 22 | int getType() const; 23 | }; -------------------------------------------------------------------------------- /Settings.cpp: -------------------------------------------------------------------------------- 1 | #include "Settings.h" 2 | 3 | Settings::Settings(MyWindow * window) : Panel(window) 4 | { 5 | //Init 6 | if (!volume.loadFromFile("images/settings/volume.png")) {}; 7 | if (!music.loadFromFile("images/settings/music.png")) {}; 8 | if (!vsync.loadFromFile("images/settings/vsync.png")) {}; 9 | pbVolume = new MyProgressBar("images/settings/vol_bar.png"); 10 | back = new MyButton("images/settings/back.png", "images/settings/back_s.png"); 11 | 12 | _volume = sf::Sprite(volume); 13 | _music = sf::Sprite(music); 14 | _vsync = sf::Sprite(vsync); 15 | cbMusic = new MyCheckbox(); 16 | cbVsync = new MyCheckbox(); 17 | 18 | //Init positions 19 | _volume.setPosition(255, 255); 20 | _music.setPosition(255,367); 21 | _vsync.setPosition(255,479); 22 | pbVolume->setPositionBar(820,273); 23 | pbVolume->setPosition(986, 259); 24 | cbMusic->setPosition(960,371); 25 | cbVsync->setPosition(960,481); 26 | back->setPosition(23, 28); 27 | 28 | //Config sync 29 | pbVolume->setPercentage(getWindow()->getConfig()->getVolume()); 30 | cbMusic->setChecked(getWindow()->getConfig()->isMusicOn()); 31 | cbVsync->setChecked(getWindow()->getConfig()->isVsyncOn()); 32 | } 33 | 34 | Settings::~Settings() 35 | { 36 | delete pbVolume; 37 | delete cbMusic; 38 | delete cbVsync; 39 | delete back; 40 | } 41 | 42 | void Settings::init() 43 | { 44 | back->setVolume(getWindow()->getConfig()->getVolume()); 45 | getWindow()->clear(); 46 | getWindow()->draw(getBackground()); 47 | getWindow()->draw(_volume); 48 | getWindow()->draw(_music); 49 | getWindow()->draw(_vsync); 50 | getWindow()->draw(pbVolume->getSpriteBar()); 51 | getWindow()->draw(pbVolume->getSprite()); 52 | getWindow()->draw(cbMusic->getSprite()); 53 | getWindow()->draw(cbVsync->getSprite()); 54 | getWindow()->draw(back->getSprite()); 55 | } 56 | 57 | int Settings::keyPressedOnce(sf::Keyboard::Key key) 58 | { 59 | switch (key) { 60 | case(sf::Keyboard::Key::Escape): return Panel::PANEL_MENU; break; 61 | } 62 | return -1; 63 | } 64 | 65 | int Settings::keyPressed(int key) 66 | { 67 | return -1; 68 | } 69 | 70 | int Settings::mouseMove(int x, int y) { 71 | if (back->isSelected(x, y)) { 72 | back->changeTexture(); 73 | } 74 | return -1; 75 | } 76 | 77 | int Settings::mouseClicked(int x, int y, sf::Mouse::Button button) 78 | { 79 | if (button == sf::Mouse::Button::Left) { 80 | if (pbVolume->setPercentage(x, y)) { 81 | getWindow()->getConfig()->setVolume(pbVolume->getPercentage()); 82 | } 83 | else if (cbMusic->setChecked(x, y)) { 84 | cbMusic->setChecked(!cbMusic->isChecked()); 85 | getWindow()->getConfig()->setMusic(cbMusic->isChecked()); 86 | } 87 | else if (cbVsync->setChecked(x, y)) { 88 | cbVsync->setChecked(!cbVsync->isChecked()); 89 | getWindow()->getConfig()->setVsync(cbVsync->isChecked()); 90 | } 91 | else if (back->isSelected(x, y)) { 92 | return Panel::PANEL_MENU; 93 | } 94 | } 95 | return -1; 96 | } 97 | 98 | int Settings::getType() const 99 | { 100 | return Panel::PANEL_SETTINGS; 101 | } 102 | -------------------------------------------------------------------------------- /Settings.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyProgressBar.h" 3 | #include "MyCheckbox.h" 4 | #include "MyButton.h" 5 | #pragma once 6 | class Settings : public Panel 7 | { 8 | private: 9 | sf::Texture volume, music, vsync; 10 | sf::Sprite _volume, _music, _vsync; 11 | MyProgressBar *pbVolume; 12 | MyCheckbox *cbMusic, *cbVsync; 13 | MyButton *back; 14 | public: 15 | Settings(MyWindow* window); 16 | ~Settings(); 17 | void init(); 18 | //Listeners 19 | int keyPressedOnce(sf::Keyboard::Key key); 20 | int keyPressed(int key); 21 | int mouseMove(int x, int y); 22 | int mouseClicked(int x, int y, sf::Mouse::Button button); 23 | //Getters 24 | int getType() const; 25 | }; 26 | 27 | -------------------------------------------------------------------------------- /Shop.cpp: -------------------------------------------------------------------------------- 1 | #include "Shop.h" 2 | 3 | Shop::Shop(MyWindow* window) : Panel(window) 4 | { 5 | std::stringstream path, path2; 6 | MyButton *tmp; 7 | int x, y; 8 | for (size_t i = 0; i < 15; i++) { 9 | path.str(""); 10 | path2.str(""); 11 | path << "images/shop/card" << i << ".png"; 12 | path2 << "images/shop/card" << i << "_s.png"; 13 | tmp = new MyButton(path.str() , path2.str()); 14 | tmp->setVolume(getWindow()->getConfig()->getVolume()); 15 | tmp->setToDo(i); 16 | x = 79 + ((i % 5) * 258); 17 | y = 171 + ((i / 5) * 214); 18 | tmp->setPosition(x,y); 19 | cards.push_back(tmp); 20 | } 21 | if (!shop.loadFromFile("images/menu/btn_shop.png")) {}; 22 | if (!star.loadFromFile("images/obstacles/star.png")) {}; 23 | back = new MyButton("images/settings/back.png", "images/settings/back_s.png"); 24 | back->setVolume(getWindow()->getConfig()->getVolume()); 25 | if (!font.loadFromFile("fonts/masterbreaker.ttf")) {} 26 | 27 | _shop = sf::Sprite(shop); 28 | _star = sf::Sprite(star); 29 | 30 | _shop.setPosition(435, 52); 31 | _star.setPosition(1356, 14); 32 | back->setPosition(23, 28); 33 | 34 | _nbrStar = sf::Text(getWindow()->getConfig()->getNbrStarString(), font, 80); 35 | _nbrStar.setFillColor(sf::Color(249, 148, 7)); 36 | _nbrStar.setPosition(1265, -10); 37 | } 38 | 39 | Shop::~Shop() 40 | { 41 | for (size_t i = 0; i < cards.size(); i++) { 42 | delete cards[i]; 43 | } 44 | delete back; 45 | } 46 | 47 | void Shop::init() 48 | { 49 | _nbrStar.setString(getWindow()->getConfig()->getNbrStarString()); 50 | getWindow()->clear(); 51 | getWindow()->draw(getBackground()); 52 | getWindow()->draw(_shop); 53 | getWindow()->draw(_star); 54 | getWindow()->draw(_nbrStar); 55 | getWindow()->draw(back->getSprite()); 56 | for (size_t i = 0; i < cards.size(); i++) { 57 | if (i != 0) { 58 | if ((i % 2) == 0 && getWindow()->getConfig()->getColors()[i / 2]) { 59 | cards[i]->changeTexture(); 60 | } 61 | else if ((i % 2) != 0 && getWindow()->getConfig()->getSpaceships()[i / 2 + 1]) { 62 | cards[i]->changeTexture(); 63 | } 64 | } 65 | else { 66 | if (getWindow()->getConfig()->getColors()[8]) { 67 | cards[i]->changeTexture(); 68 | } 69 | } 70 | getWindow()->draw(cards[i]->getSprite()); 71 | } 72 | } 73 | 74 | int Shop::keyPressedOnce(sf::Keyboard::Key key) 75 | { 76 | switch (key) { 77 | case(sf::Keyboard::Key::Escape): return Panel::PANEL_MENU; break; 78 | } 79 | return -1; 80 | } 81 | 82 | int Shop::mouseClicked(int x, int y, sf::Mouse::Button button) 83 | { 84 | if (button == sf::Mouse::Button::Left) { 85 | if (back->isSelected(x, y)) { 86 | return Panel::PANEL_MENU; 87 | } 88 | else { 89 | for (size_t i = 0; i < cards.size(); i++) { 90 | if (cards[i]->isSelected(x, y)) { 91 | if (i != 0) { 92 | if ((i % 2) == 0) { 93 | getWindow()->getConfig()->buyColor(i / 2); 94 | } 95 | else if ((i % 2) != 0) { 96 | getWindow()->getConfig()->buySpaceship(i / 2 + 1); 97 | } 98 | } 99 | else { 100 | getWindow()->getConfig()->buyColor(8); 101 | } 102 | } 103 | } 104 | } 105 | } 106 | return -1; 107 | } 108 | 109 | int Shop::mouseMove(int x, int y) { 110 | if (back->isSelected(x, y)) { 111 | back->changeTexture(); 112 | } 113 | return -1; 114 | } 115 | 116 | int Shop::getType() const 117 | { 118 | return Panel::PANEL_SHOP; 119 | } 120 | -------------------------------------------------------------------------------- /Shop.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #include "MyButton.h" 3 | #include 4 | #pragma once 5 | class Shop : public Panel 6 | { 7 | private: 8 | std::vector cards; 9 | sf::Texture shop, star; 10 | sf::Sprite _shop, _star; 11 | sf::Font font; 12 | sf::Text _nbrStar; 13 | MyButton *back; 14 | public: 15 | Shop(MyWindow* window); 16 | ~Shop(); 17 | void init(); 18 | //Listeners 19 | int keyPressedOnce(sf::Keyboard::Key key); 20 | int mouseClicked(int x, int y, sf::Mouse::Button button); 21 | int mouseMove(int x, int y); 22 | //Getters 23 | int getType() const; 24 | }; 25 | 26 | -------------------------------------------------------------------------------- /Spaceship.cpp: -------------------------------------------------------------------------------- 1 | #include "Spaceship.h" 2 | #include 3 | #include 4 | 5 | /* 6 | * Get the string value of a color between 0 and 7 7 | */ 8 | std::string Spaceship::getColor(int color) const 9 | { 10 | switch (color) 11 | { 12 | case Spaceship::SPACESHIP_COLOR_RED: return "red"; 13 | case Spaceship::SPACESHIP_COLOR_YELLOW: return "yellow"; 14 | case Spaceship::SPACESHIP_COLOR_GREEN: return "green"; 15 | case Spaceship::SPACESHIP_COLOR_BLUE: return "blue"; 16 | case Spaceship::SPACESHIP_COLOR_PURPLE: return "purple"; 17 | case Spaceship::SPACESHIP_COLOR_PINK: return "pink"; 18 | case Spaceship::SPACESHIP_COLOR_GREY: return "grey"; 19 | case Spaceship::SPACESHIP_COLOR_ORANGE: return "orange"; 20 | default: 21 | return "red"; 22 | } 23 | } 24 | 25 | /* 26 | * Initialise spaceship speed, health and guns position 27 | */ 28 | void Spaceship::initSpaceship(int type) 29 | { 30 | switch (type) 31 | { 32 | case Spaceship::SPACESHIP_SKIN_0: _speed = 9; _health = _maxHealth = 120; 33 | guns = sf::Vector3i(68,44,0); 34 | break; 35 | case Spaceship::SPACESHIP_SKIN_1: _speed = 6; _health = _maxHealth = 180; 36 | guns = sf::Vector3i(84, 30, 86); _doubleGun=true; 37 | break; 38 | case Spaceship::SPACESHIP_SKIN_2: _speed = 6; _health = _maxHealth = 180; 39 | guns = sf::Vector3i(54, 64, 0); 40 | break; 41 | case Spaceship::SPACESHIP_SKIN_3: _speed = 9; _health = _maxHealth = 120; 42 | guns = sf::Vector3i(95, 42, 0); 43 | break; 44 | case Spaceship::SPACESHIP_SKIN_4: _speed = 6; _health = _maxHealth = 180; 45 | guns = sf::Vector3i(80, 42, 85); _doubleGun = true; 46 | break; 47 | case Spaceship::SPACESHIP_SKIN_5: _speed = 9; _health = _maxHealth = 120; 48 | guns = sf::Vector3i(46, 17, 74); _doubleGun = true; 49 | break; 50 | case Spaceship::SPACESHIP_SKIN_6: _speed = 12; _health = _maxHealth = 90; 51 | guns = sf::Vector3i(55, 15, 89); _doubleGun = true; 52 | break; 53 | case Spaceship::SPACESHIP_SKIN_7: _speed = 12; _health = _maxHealth = 90; 54 | guns = sf::Vector3i(42, 21, 75); _doubleGun = true; 55 | break; 56 | case Spaceship::SPACESHIP_SKIN_8: _speed = 12; _health = _maxHealth = 90; 57 | guns = sf::Vector3i(37, 45, 0); 58 | break; 59 | } 60 | } 61 | 62 | /* 63 | * Default constructor 64 | */ 65 | Spaceship::Spaceship() 66 | { 67 | } 68 | 69 | /* 70 | * Advanced Default Constructor 71 | */ 72 | Spaceship::Spaceship(int skinType) : Spaceship(skinType, Spaceship::SPACESHIP_COLOR_RED) 73 | { 74 | } 75 | 76 | /* 77 | * Constructor 78 | */ 79 | Spaceship::Spaceship(int skinType, int colorType) { 80 | std::stringstream path; 81 | _skin = skinType; 82 | _color = colorType; 83 | initSpaceship(skinType); 84 | path << "images/spaceships/spaceship" << skinType << "/" << getColor(colorType) << ".png"; 85 | if (!texture.loadFromFile(path.str())) {}; 86 | sprite = sf::Sprite(texture); 87 | } 88 | 89 | /* 90 | * Destructor 91 | */ 92 | Spaceship::~Spaceship() 93 | { 94 | } 95 | 96 | /* 97 | * Set spaceship position 98 | */ 99 | void Spaceship::setPosition(int x, int y) 100 | { 101 | sprite.setPosition(x, y); 102 | } 103 | 104 | /* 105 | * Move the spaceship with it speed and to a direction 106 | */ 107 | void Spaceship::move(int keyX, int keyY) 108 | { 109 | if(keyX>=-1 && keyX<= 1 && keyY>=-1 && keyY<=1) 110 | sprite.move(keyX*_speed, keyY*_speed); 111 | } 112 | 113 | /* 114 | * Remove health when the spaceship is hit 115 | */ 116 | void Spaceship::takeDamages() 117 | { 118 | _health -= 30; 119 | if (_health <= 0) { 120 | _health = 0; 121 | } 122 | } 123 | 124 | /* 125 | * Set the spaceship skin 126 | */ 127 | void Spaceship::setSkin(int skinType, int colorType) 128 | { 129 | std::stringstream path; 130 | _skin = skinType; 131 | _color = colorType; 132 | initSpaceship(skinType); 133 | path << "images/spaceships/spaceship" << skinType << "/" << getColor(colorType) << ".png"; 134 | if (!texture.loadFromFile(path.str())) {}; 135 | sprite = sf::Sprite(texture); 136 | } 137 | 138 | /* 139 | * Add health to the spaceship 140 | */ 141 | void Spaceship::addHealth() 142 | { 143 | _health += 30; 144 | if (_health > _maxHealth) { 145 | _health = _maxHealth; 146 | } 147 | } 148 | 149 | //Getters 150 | int Spaceship::getWidth() const 151 | { 152 | return texture.getSize().x; 153 | } 154 | 155 | int Spaceship::getHeight() const 156 | { 157 | return texture.getSize().y; 158 | } 159 | 160 | int Spaceship::getSkin() const 161 | { 162 | return _skin; 163 | } 164 | 165 | int Spaceship::getColor() const 166 | { 167 | return _color; 168 | } 169 | 170 | int Spaceship::getX() const 171 | { 172 | return sprite.getPosition().x; 173 | } 174 | 175 | int Spaceship::getY() const 176 | { 177 | return sprite.getPosition().y; 178 | } 179 | 180 | int Spaceship::getHealth() const 181 | { 182 | return _health; 183 | } 184 | 185 | float Spaceship::getMaxHealth() const 186 | { 187 | return _maxHealth; 188 | } 189 | 190 | bool Spaceship::hasDoubleGun() const 191 | { 192 | return _doubleGun; 193 | } 194 | 195 | sf::Vector3i Spaceship::getGuns() const 196 | { 197 | return sf::Vector3i(guns); 198 | } 199 | 200 | sf::Sprite Spaceship::getSprite() const 201 | { 202 | return sf::Sprite(sprite); 203 | } 204 | -------------------------------------------------------------------------------- /Spaceship.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #pragma once 4 | class Spaceship 5 | { 6 | private: 7 | sf::Texture texture; 8 | sf::Sprite sprite; 9 | sf::Vector3i guns; 10 | bool _doubleGun = false; 11 | int _speed, _health, _skin, _color; 12 | float _maxHealth; 13 | std::string getColor(int color) const; 14 | void initSpaceship(int type); 15 | public: 16 | enum { 17 | SPACESHIP_SKIN_0, SPACESHIP_SKIN_1, SPACESHIP_SKIN_2, 18 | SPACESHIP_SKIN_3, SPACESHIP_SKIN_4, SPACESHIP_SKIN_5, 19 | SPACESHIP_SKIN_6, SPACESHIP_SKIN_7, SPACESHIP_SKIN_8 20 | }; 21 | enum { 22 | SPACESHIP_COLOR_RED, SPACESHIP_COLOR_YELLOW, 23 | SPACESHIP_COLOR_GREEN, SPACESHIP_COLOR_BLUE, 24 | SPACESHIP_COLOR_PURPLE, SPACESHIP_COLOR_PINK, 25 | SPACESHIP_COLOR_GREY, SPACESHIP_COLOR_ORANGE, 26 | }; 27 | Spaceship(); 28 | Spaceship(int skinType); 29 | Spaceship(int skinType, int colorType); 30 | ~Spaceship(); 31 | void setPosition(int x, int y); 32 | void move(int x, int y); 33 | void takeDamages(); 34 | //Setter 35 | void setSkin(int skinType, int colorType); 36 | void addHealth(); 37 | //Getters 38 | int getWidth() const; 39 | int getHeight() const; 40 | int getSkin() const; 41 | int getColor() const; 42 | int getX() const; 43 | int getY() const; 44 | int getHealth() const; 45 | float getMaxHealth() const; 46 | bool hasDoubleGun() const; 47 | sf::Vector3i getGuns() const; 48 | sf::Sprite getSprite() const; 49 | }; 50 | 51 | -------------------------------------------------------------------------------- /Splashscreen.cpp: -------------------------------------------------------------------------------- 1 | #include "Splashscreen.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "Menu.h" 7 | 8 | Splashscreen::Splashscreen(MyWindow* window) : Panel(window) { 9 | 10 | 11 | //Init textures 12 | if (!shadow.loadFromFile("images/splashscreen/shadow.png")) {}; 13 | if (!logo.loadFromFile("images/splashscreen/logo.png")) {}; 14 | if (!button.loadFromFile("images/splashscreen/btn_keys.png")) {}; 15 | if (!buttonOff.create(button.getSize().x , button.getSize().y)) {}; 16 | 17 | 18 | //Init sprites 19 | _shadow = sf::Sprite(shadow); 20 | _logo = sf::Sprite(logo); 21 | _button = sf::Sprite(button); 22 | 23 | //Set sprites 24 | _logo.setPosition(433, 259); 25 | _button.setPosition(381, 670); 26 | } 27 | 28 | void Splashscreen::init() 29 | { 30 | getWindow()->clear(); 31 | //Draw sprites 32 | getWindow()->draw(getBackground()); 33 | getWindow()->draw(_shadow); 34 | getWindow()->draw(_logo); 35 | getWindow()->draw(_button); 36 | } 37 | 38 | void Splashscreen::blink() 39 | { 40 | if(!visible) { 41 | _button.setTexture(button); 42 | visible = true; 43 | } 44 | else { 45 | _button.setTexture(buttonOff); 46 | visible = false; 47 | } 48 | } 49 | 50 | int Splashscreen::keyPressedOnce(sf::Keyboard::Key key) 51 | { 52 | return Panel::PANEL_MENU; 53 | } 54 | 55 | int Splashscreen::getType() const { 56 | return Panel::PANEL_SPLASHSCREEN; 57 | } 58 | -------------------------------------------------------------------------------- /Splashscreen.h: -------------------------------------------------------------------------------- 1 | #include "Panel.h" 2 | #pragma once 3 | class Splashscreen : public Panel 4 | { 5 | private: 6 | sf::Texture shadow, logo, button, buttonOff; 7 | sf::Sprite _shadow, _logo, _button; 8 | public: 9 | Splashscreen(MyWindow* window); 10 | bool visible; 11 | void init(); 12 | void blink(); 13 | int keyPressedOnce(sf::Keyboard::Key key); 14 | int getType() const; 15 | }; 16 | 17 | -------------------------------------------------------------------------------- /Star.cpp: -------------------------------------------------------------------------------- 1 | #include "Star.h" 2 | 3 | /* 4 | * Constructor 5 | */ 6 | Star::Star(int minX, int minY, int y) 7 | { 8 | //Sprite loading 9 | if (!texture.loadFromFile("images/obstacles/star.png")) {}; 10 | sprite = sf::Sprite(texture); 11 | //Set position out of screen 12 | int posX = minX + texture.getSize().x; 13 | int posY = y % (minY - texture.getSize().y); 14 | sprite.setPosition(posX, posY); 15 | //Set type 16 | _type = Obstacle::TYPE_STAR; 17 | } 18 | 19 | /* 20 | * Destructor 21 | */ 22 | Star::~Star() 23 | { 24 | } 25 | -------------------------------------------------------------------------------- /Star.h: -------------------------------------------------------------------------------- 1 | #include "Obstacle.h" 2 | #pragma once 3 | class Star : public Obstacle 4 | { 5 | public: 6 | Star(int minX, int minY, int y); 7 | ~Star(); 8 | }; 9 | 10 | -------------------------------------------------------------------------------- /config.cfg: -------------------------------------------------------------------------------- 1 | 1 2 | 65 3 | 5 4 | 23 5 | 64 6 | 7 7 | 6 8 | 0 9 | 1 10 | 9 11 | 1 12 | 1 13 | 1 14 | 0 15 | 1 16 | 1 17 | 0 18 | 1 19 | 1 20 | 9 21 | 1 22 | 1 23 | 1 24 | 1 25 | 1 26 | 1 27 | 0 28 | 1 29 | 1 30 | 10 31 | 9703 32 | 8274 33 | 7726 34 | 4139 35 | 3394 36 | 2924 37 | 2411 38 | 1488 39 | 911 40 | 878 41 | 10 42 | 04/14/18 43 | 12/11/17 44 | 11/27/17 45 | 11/25/17 46 | 12/11/17 47 | 12/19/17 48 | 12/19/17 49 | 12/11/17 50 | 11/25/17 51 | 04/14/18 52 | -------------------------------------------------------------------------------- /doc/screenshot0.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot0.PNG -------------------------------------------------------------------------------- /doc/screenshot1.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot1.PNG -------------------------------------------------------------------------------- /doc/screenshot2.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot2.PNG -------------------------------------------------------------------------------- /doc/screenshot3.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot3.PNG -------------------------------------------------------------------------------- /doc/screenshot4.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot4.PNG -------------------------------------------------------------------------------- /doc/screenshot5.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot5.PNG -------------------------------------------------------------------------------- /doc/screenshot6.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot6.PNG -------------------------------------------------------------------------------- /doc/screenshot7.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/doc/screenshot7.PNG -------------------------------------------------------------------------------- /fonts/masterbreaker.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/fonts/masterbreaker.ttf -------------------------------------------------------------------------------- /icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/icon.ico -------------------------------------------------------------------------------- /images/account/color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color.png -------------------------------------------------------------------------------- /images/account/color0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color0.png -------------------------------------------------------------------------------- /images/account/color1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color1.png -------------------------------------------------------------------------------- /images/account/color2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color2.png -------------------------------------------------------------------------------- /images/account/color3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color3.png -------------------------------------------------------------------------------- /images/account/color4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color4.png -------------------------------------------------------------------------------- /images/account/color5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color5.png -------------------------------------------------------------------------------- /images/account/color6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color6.png -------------------------------------------------------------------------------- /images/account/color7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/color7.png -------------------------------------------------------------------------------- /images/account/exp_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/exp_bar.png -------------------------------------------------------------------------------- /images/account/selectedColor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/selectedColor.png -------------------------------------------------------------------------------- /images/account/spaceship0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship0.png -------------------------------------------------------------------------------- /images/account/spaceship0_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship0_s.png -------------------------------------------------------------------------------- /images/account/spaceship1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship1.png -------------------------------------------------------------------------------- /images/account/spaceship1_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship1_s.png -------------------------------------------------------------------------------- /images/account/spaceship2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship2.png -------------------------------------------------------------------------------- /images/account/spaceship2_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship2_s.png -------------------------------------------------------------------------------- /images/account/spaceship3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship3.png -------------------------------------------------------------------------------- /images/account/spaceship3_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship3_s.png -------------------------------------------------------------------------------- /images/account/spaceship4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship4.png -------------------------------------------------------------------------------- /images/account/spaceship4_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship4_s.png -------------------------------------------------------------------------------- /images/account/spaceship5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship5.png -------------------------------------------------------------------------------- /images/account/spaceship5_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship5_s.png -------------------------------------------------------------------------------- /images/account/spaceship6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship6.png -------------------------------------------------------------------------------- /images/account/spaceship6_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship6_s.png -------------------------------------------------------------------------------- /images/account/spaceship7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship7.png -------------------------------------------------------------------------------- /images/account/spaceship7_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship7_s.png -------------------------------------------------------------------------------- /images/account/spaceship8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship8.png -------------------------------------------------------------------------------- /images/account/spaceship8_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/account/spaceship8_s.png -------------------------------------------------------------------------------- /images/background.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/background.png -------------------------------------------------------------------------------- /images/bonus/bonus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/bonus/bonus.png -------------------------------------------------------------------------------- /images/bonus/bonus0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/bonus/bonus0.png -------------------------------------------------------------------------------- /images/bonus/bonus1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/bonus/bonus1.png -------------------------------------------------------------------------------- /images/bonus/bonus2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/bonus/bonus2.png -------------------------------------------------------------------------------- /images/bonus/bonus4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/bonus/bonus4.png -------------------------------------------------------------------------------- /images/game/bonus.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/bonus.png -------------------------------------------------------------------------------- /images/game/btn_menu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/btn_menu.png -------------------------------------------------------------------------------- /images/game/btn_menu_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/btn_menu_s.png -------------------------------------------------------------------------------- /images/game/btn_quit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/btn_quit.png -------------------------------------------------------------------------------- /images/game/btn_quit_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/btn_quit_s.png -------------------------------------------------------------------------------- /images/game/gameover.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/gameover.png -------------------------------------------------------------------------------- /images/game/health.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/health.png -------------------------------------------------------------------------------- /images/game/menu_pause.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/menu_pause.png -------------------------------------------------------------------------------- /images/game/restart.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/restart.png -------------------------------------------------------------------------------- /images/game/restart_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/restart_s.png -------------------------------------------------------------------------------- /images/game/score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/game/score.png -------------------------------------------------------------------------------- /images/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/icon.png -------------------------------------------------------------------------------- /images/lasers/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/lasers/blue.png -------------------------------------------------------------------------------- /images/lasers/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/lasers/green.png -------------------------------------------------------------------------------- /images/lasers/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/lasers/red.png -------------------------------------------------------------------------------- /images/lasers/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/lasers/yellow.png -------------------------------------------------------------------------------- /images/menu/btn_account.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_account.png -------------------------------------------------------------------------------- /images/menu/btn_account_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_account_s.png -------------------------------------------------------------------------------- /images/menu/btn_credits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_credits.png -------------------------------------------------------------------------------- /images/menu/btn_credits_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_credits_s.png -------------------------------------------------------------------------------- /images/menu/btn_play.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_play.png -------------------------------------------------------------------------------- /images/menu/btn_play_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_play_s.png -------------------------------------------------------------------------------- /images/menu/btn_score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_score.png -------------------------------------------------------------------------------- /images/menu/btn_score_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_score_s.png -------------------------------------------------------------------------------- /images/menu/btn_settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_settings.png -------------------------------------------------------------------------------- /images/menu/btn_settings_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_settings_s.png -------------------------------------------------------------------------------- /images/menu/btn_shop.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_shop.png -------------------------------------------------------------------------------- /images/menu/btn_shop_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/menu/btn_shop_s.png -------------------------------------------------------------------------------- /images/obstacles/ennemy0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/ennemy0.png -------------------------------------------------------------------------------- /images/obstacles/ennemy1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/ennemy1.png -------------------------------------------------------------------------------- /images/obstacles/ennemy2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/ennemy2.png -------------------------------------------------------------------------------- /images/obstacles/ennemy3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/ennemy3.png -------------------------------------------------------------------------------- /images/obstacles/ennemy4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/ennemy4.png -------------------------------------------------------------------------------- /images/obstacles/heal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/heal.png -------------------------------------------------------------------------------- /images/obstacles/meteor0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/meteor0.png -------------------------------------------------------------------------------- /images/obstacles/meteor1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/meteor1.png -------------------------------------------------------------------------------- /images/obstacles/meteor2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/meteor2.png -------------------------------------------------------------------------------- /images/obstacles/random.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/random.png -------------------------------------------------------------------------------- /images/obstacles/star.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/obstacles/star.png -------------------------------------------------------------------------------- /images/scoreboard/date.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/scoreboard/date.png -------------------------------------------------------------------------------- /images/scoreboard/rank.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/scoreboard/rank.png -------------------------------------------------------------------------------- /images/scoreboard/score.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/scoreboard/score.png -------------------------------------------------------------------------------- /images/settings/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/back.png -------------------------------------------------------------------------------- /images/settings/back_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/back_s.png -------------------------------------------------------------------------------- /images/settings/checkbox.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/checkbox.png -------------------------------------------------------------------------------- /images/settings/checkbox_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/checkbox_s.png -------------------------------------------------------------------------------- /images/settings/fps.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/fps.png -------------------------------------------------------------------------------- /images/settings/fps_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/fps_bar.png -------------------------------------------------------------------------------- /images/settings/music.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/music.png -------------------------------------------------------------------------------- /images/settings/rect_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/rect_bar.png -------------------------------------------------------------------------------- /images/settings/vol_bar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/vol_bar.png -------------------------------------------------------------------------------- /images/settings/volume.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/volume.png -------------------------------------------------------------------------------- /images/settings/vsync.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/settings/vsync.png -------------------------------------------------------------------------------- /images/shop/card0.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card0.png -------------------------------------------------------------------------------- /images/shop/card0_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card0_s.png -------------------------------------------------------------------------------- /images/shop/card1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card1.png -------------------------------------------------------------------------------- /images/shop/card10.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card10.png -------------------------------------------------------------------------------- /images/shop/card10_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card10_s.png -------------------------------------------------------------------------------- /images/shop/card11.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card11.png -------------------------------------------------------------------------------- /images/shop/card11_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card11_s.png -------------------------------------------------------------------------------- /images/shop/card12.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card12.png -------------------------------------------------------------------------------- /images/shop/card12_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card12_s.png -------------------------------------------------------------------------------- /images/shop/card13.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card13.png -------------------------------------------------------------------------------- /images/shop/card13_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card13_s.png -------------------------------------------------------------------------------- /images/shop/card14.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card14.png -------------------------------------------------------------------------------- /images/shop/card14_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card14_s.png -------------------------------------------------------------------------------- /images/shop/card1_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card1_s.png -------------------------------------------------------------------------------- /images/shop/card2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card2.png -------------------------------------------------------------------------------- /images/shop/card2_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card2_s.png -------------------------------------------------------------------------------- /images/shop/card3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card3.png -------------------------------------------------------------------------------- /images/shop/card3_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card3_s.png -------------------------------------------------------------------------------- /images/shop/card4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card4.png -------------------------------------------------------------------------------- /images/shop/card4_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card4_s.png -------------------------------------------------------------------------------- /images/shop/card5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card5.png -------------------------------------------------------------------------------- /images/shop/card5_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card5_s.png -------------------------------------------------------------------------------- /images/shop/card6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card6.png -------------------------------------------------------------------------------- /images/shop/card6_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card6_s.png -------------------------------------------------------------------------------- /images/shop/card7.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card7.png -------------------------------------------------------------------------------- /images/shop/card7_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card7_s.png -------------------------------------------------------------------------------- /images/shop/card8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card8.png -------------------------------------------------------------------------------- /images/shop/card8_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card8_s.png -------------------------------------------------------------------------------- /images/shop/card9.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card9.png -------------------------------------------------------------------------------- /images/shop/card9_s.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/shop/card9_s.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship0/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship0/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship1/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship1/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship2/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship2/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship3/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship3/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship4/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship4/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship5/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship5/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship6/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship6/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship7/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship7/yellow.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/blue.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/blue.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/green.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/green.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/grey.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/grey.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/orange.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/orange.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/pink.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/pink.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/purple.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/purple.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/red.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/red.png -------------------------------------------------------------------------------- /images/spaceships/spaceship8/yellow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/spaceships/spaceship8/yellow.png -------------------------------------------------------------------------------- /images/splashscreen/btn_keys.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/splashscreen/btn_keys.png -------------------------------------------------------------------------------- /images/splashscreen/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/splashscreen/logo.png -------------------------------------------------------------------------------- /images/splashscreen/shadow.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/images/splashscreen/shadow.png -------------------------------------------------------------------------------- /main.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "Panel.h" 7 | #include "Splashscreen.h" 8 | #include "Menu.h" 9 | #include "Game.h" 10 | #include "Settings.h" 11 | #include "Shop.h" 12 | #include "Score.h" 13 | #include "Account.h" 14 | #include "Credits.h" 15 | 16 | #pragma warning (disable : 4244) 17 | #pragma warning (disable : 4305) 18 | #pragma warning (disable : 4018) 19 | 20 | int main() 21 | { 22 | //Window variables 23 | int ticks = 0; 24 | FreeConsole(); //Hide console 25 | 26 | //Init window 27 | MyWindow window(sf::VideoMode(1440, 810, 0), "SpaceGO", sf::Style::Close); 28 | window.setFramerateLimit(60); 29 | sf::Image image; 30 | image.loadFromFile("images/icon.png"); 31 | window.setIcon(128,128, image.getPixelsPtr()); 32 | 33 | //Init music 34 | sf::Music music; 35 | if (!music.openFromFile("sounds/music.wav")) 36 | {} 37 | music.setLoop(true); 38 | music.setVolume(0); 39 | music.play(); 40 | 41 | //Init panels 42 | int activePanel = 0; 43 | std::vector panels; 44 | panels.push_back(new Splashscreen(&window)); 45 | panels.push_back(new Menu(&window)); 46 | panels.push_back(new Game(&window)); 47 | panels.push_back(new Settings(&window)); 48 | panels.push_back(new Shop(&window)); 49 | panels.push_back(new Score(&window)); 50 | panels.push_back(new Account(&window)); 51 | panels.push_back(new Credits(&window)); 52 | 53 | //Program running 54 | while (window.isOpen()) 55 | { 56 | sf::Event event; 57 | if (window.getConfig()->isMusicOn()) { 58 | music.setVolume(window.getConfig()->getVolume()); 59 | } 60 | else { 61 | music.setVolume(0); 62 | } 63 | window.setVerticalSyncEnabled(window.getConfig()->isVsyncOn()); 64 | //Event manager 65 | while (window.pollEvent(event)) 66 | { 67 | switch (event.type) 68 | { 69 | case sf::Event::Closed: 70 | window.getConfig()->save(); 71 | window.close(); 72 | break; 73 | case sf::Event::KeyPressed: 74 | if (panels[activePanel]->keyPressedOnce(event.key.code)!=-1) { 75 | activePanel = panels[activePanel]->keyPressedOnce(event.key.code); 76 | } 77 | break; 78 | case sf::Event::MouseButtonPressed: 79 | if (panels[activePanel]->mouseClicked(event.mouseButton.x, event.mouseButton.y, event.mouseButton.button) >= 0) { 80 | activePanel = panels[activePanel]->mouseClicked(event.mouseButton.x, event.mouseButton.y, event.mouseButton.button); 81 | } 82 | break; 83 | case sf::Event::MouseMoved: 84 | if (panels[activePanel]->mouseMove(event.mouseMove.x, event.mouseMove.y) >= 0) { 85 | activePanel = panels[activePanel]->mouseMove(event.mouseMove.x, event.mouseMove.y); 86 | } 87 | break; 88 | } 89 | } 90 | //Background animation 91 | panels[activePanel]->moveBackground(); 92 | if (panels[activePanel]->getType() == Panel::PANEL_SPLASHSCREEN) { 93 | ticks++; 94 | if (ticks >= 30) { 95 | panels[activePanel]->blink(); 96 | ticks = 0; 97 | } 98 | } 99 | 100 | //Keys manager 101 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::Z)) { 102 | panels[activePanel]->keyPressed(sf::Keyboard::Z); 103 | } 104 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::S)) { 105 | panels[activePanel]->keyPressed(sf::Keyboard::S); 106 | } 107 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::Q)) { 108 | panels[activePanel]->keyPressed(sf::Keyboard::Q); 109 | } 110 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::D)) { 111 | panels[activePanel]->keyPressed(sf::Keyboard::D); 112 | } 113 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::Space)) { 114 | panels[activePanel]->keyPressed(sf::Keyboard::Space); 115 | } 116 | if (sf::Keyboard::isKeyPressed(sf::Keyboard::R)) { 117 | panels[activePanel]->keyPressed(sf::Keyboard::R); 118 | } 119 | 120 | //Init view 121 | window.clear(); 122 | panels[activePanel]->init(); 123 | window.display(); 124 | } 125 | 126 | return 0; 127 | } -------------------------------------------------------------------------------- /resource.rc: -------------------------------------------------------------------------------- 1 | AAA ICON icon.ico 2 | -------------------------------------------------------------------------------- /sounds/button.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/sounds/button.wav -------------------------------------------------------------------------------- /sounds/laser.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Fromont-Sam/SpaceGO/a0e41e7304ddb5421dff10d7107ea558008f03a7/sounds/laser.wav --------------------------------------------------------------------------------