Skip to content

AliGhaedrahmat/SpaceInvaders

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Space Invaders Clone

output

๐Ÿš€ Description

This project is a classic Space Invaders clone developed in C++ as a university project. It runs entirely in the console and uses ASCII characters to render the game's graphics. The game faithfully recreates the core mechanics of the original arcade classic, where the player controls a spaceship to defend against waves of descending aliens.

โœจ Features

  • Classic Gameplay: Experience the timeless gameplay of Space Invaders, with waves of enemies moving horizontally and progressively downward.
  • Player Control: Maneuver your spaceship left and right to dodge enemy projectiles and position yourself for the perfect shot.
  • Scoring System: Earn points for every enemy you destroy. Different types of enemies award different scores.
  • Multiple Enemy Types: Face off against different alien types, each with its own unique appearance.
  • Persistent Leaderboard: Your high scores are saved to a leaderboard, so you can compete with your friends and track your progress.
  • Customizable Spaceships: Choose from a variety of spaceship designs to personalize your gaming experience.
  • Power-ups and Special Events: Look out for the special flying saucer that appears occasionally, shooting it down will grant you bonus points.
  • Game Modifiers: Customize your gameplay with options like "Insane Mode" for a more challenging experience.
  • Save/Load Functionality: Save your game progress and load it later to continue your session.

๐ŸŽฎ How to Play

  1. Start a New Game: From the main menu, select "New Game" and enter your name.
  2. Choose Your Spaceship: Select your preferred spaceship design.
  3. Controls:
    • A or Left Arrow: Move the spaceship left.
    • D or Right Arrow: Move the spaceship right.
    • Spacebar: Shoot a bullet.
    • P: Pause the game.
  4. Objective: Shoot down all the aliens in each wave before they reach the bottom of the screen.
  5. Lives: You start with a set number of lives. You lose a life if you get hit by an enemy bullet.
  6. Game Over: The game ends when you lose all your lives or when the aliens reach the bottom of the screen.

(GIF of gameplay will be inserted here)

๐Ÿ› ๏ธ Getting Started

Prerequisites

  • A C++ compiler (like G++)
  • Windows operating system (due to the use of Windows-specific libraries like <conio.h> and <windows.h>)

Installation & Compilation

  1. Clone the repository:
    git clone https://github.com/your-username/your-repository-name.git
  2. Navigate to the project directory:
    cd your-repository-name
  3. Compile the source code:
    g++ -o "Space Invaders" main.cpp src/Console.cpp src/Menu.cpp -lwinmm
  4. Run the executable:
    ./"Space Invaders"

๐Ÿ“‚ File Structure

.
โ”œโ”€โ”€ main.cpp
โ””โ”€โ”€ src
    โ”œโ”€โ”€ Console.cpp
    โ”œโ”€โ”€ Console.h
    โ”œโ”€โ”€ Disk.h
    โ”œโ”€โ”€ Enemy.h
    โ”œโ”€โ”€ File.h
    โ”œโ”€โ”€ Files
    โ”‚   โ””โ”€โ”€ leaderboard.txt
    โ”œโ”€โ”€ Game.h
    โ”œโ”€โ”€ Grid.h
    โ”œโ”€โ”€ Leaderboard.h
    โ”œโ”€โ”€ Load.h
    โ”œโ”€โ”€ Menu.cpp
    โ”œโ”€โ”€ Menu.h
    โ”œโ”€โ”€ Pause.h
    โ””โ”€โ”€ player.h

Key Files and Their Purpose

  • main.cpp: The entry point of the application. It initializes the console and starts the main menu loop.
  • src/Console.h & src/Console.cpp: These files manage all the console-related functionalities like drawing on the screen, handling colors, and managing the cursor.
  • src/Game.h: This header file contains the main game loop, logic for collision detection, player movement, shooting, and the end-game menu.
  • src/Menu.h & src/Menu.cpp: These files are responsible for displaying and handling interactions with all the game's menus, including the main menu, options screen, and spaceship selection.
  • src/Enemy.h: This file defines the behavior of the enemy aliens, including their movement patterns and attack logic.
  • src/player.h: Defines the Player structure, which holds all the relevant data for the player, such as score, lives, and level.
  • src/Grid.h: Manages the game's grid system, where all game objects (player, enemies, bullets) are placed and rendered.
  • src/Leaderboard.h: Contains the logic for reading, sorting, and displaying the high scores from the leaderboard file.
  • src/Files/leaderboard.txt: A text file that stores the player's name, score, and other game statistics for the leaderboard.

๐Ÿค Contributing

Contributions are welcome! If you have any ideas, suggestions, or bug fixes, please open an issue or submit a pull request. Google Search Suggestions Display of Search Suggestions is required when using Grounding with Google Search. Learn more Google logo

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published