A space-themed typing game where you defend against incoming asteroids by typing words correctly. Test your typing speed and accuracy while enjoying arcade-style gameplay!
- Space shooter mechanics combined with typing practice
- Dynamic difficulty scaling based on score
- Score tracking with high score system
- Smooth spacecraft movement
- Word-based asteroid destruction
- Lives system
- Performance metrics (correct/wrong words)
To build and run Typing Warrior, you need:
- SDL2 library and its extensions:
- SDL2_image
- SDL2_ttf
- SDL2_mixer
- C compiler (gcc recommended)
- Make (for building)
typing-warrior/
โโโ src/
โ โโโ main.c
โ โโโ game.c
โ โโโ menu.c
โ โโโ score.c
โ โโโ button.c
โโโ include/
โ โโโ all_headers.h
โ โโโ game.h
โ โโโ menu.h
โ โโโ score.h
โ โโโ button.h
โโโ img/
โ โโโ asteroid.png
โ โโโ _ship.png
โ โโโ spexpb.bmp
โ โโโ btn.png
โ โโโ btn_hover.png
โโโ others/
โโโ my_font.otf
โโโ words.txt
โโโ highestScore.txt
-
Main Menu
- Choose between Play and Exit options
- Simple and intuitive interface
-
Game
- Control your spacecraft with A/D or Left/Right arrow keys
- Press SPACE to shoot at asteroids
- Type the displayed words correctly to destroy asteroids
- Each successful hit increases your score
- Missing words or letting asteroids pass reduces lives
- Game ends when you run out of lives
-
Scoring System
- Points awarded based on word position when destroyed
- Higher points for destroying asteroids quickly
- Score penalties for incorrect words
- High score system tracks your best performance
- A/Left Arrow: Move spacecraft left
- D/Right Arrow: Move spacecraft right
- SPACE: Shoot
- Keyboard: Type words to destroy asteroids
- ESC: Return to menu
First, ensure you have the following installed on your MacBook:
-
Xcode Command Line Tools
xcode-select --install
-
Homebrew (Package Manager)
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
-
Install SDL2 and required libraries using Homebrew:
brew install sdl2 sdl2_image sdl2_ttf sdl2_mixer
Or use the provided make command:
make install-deps
-
Clone the repository:
git clone https://github.com/RoyDibyaJyoti/typing_warrior cd typing-warrior
-
Build the game using make:
make
After successful compilation, run the game using:
./typing_warrior
If you encounter any issues:
-
SDL2 Header Files Not Found
- Verify SDL2 installation:
brew list sdl2 brew list sdl2_image brew list sdl2_ttf brew list sdl2_mixer
- Try reinstalling the libraries:
brew reinstall sdl2 sdl2_image sdl2_ttf sdl2_mixer
- Verify SDL2 installation:
-
Compilation Errors
- Make sure all dependencies are properly installed
- Check if Xcode Command Line Tools are installed correctly
- Try cleaning and rebuilding:
make clean make
-
Library Linking Issues
- Verify the library paths:
brew --prefix sdl2
- Make sure the paths in the Makefile match your system
- Verify the library paths:
-
MinGW (Minimalist GNU for Windows)
- Download and install from MinGW
-
SDL2 Development Libraries
- Download SDL2, SDL2_image, SDL2_ttf, and SDL2_mixer development libraries from libsdl.org
- Extract the SDL2 libraries and place them in a known directory.
-
Clone the repository:
git clone https://github.com/RoyDibyaJyoti/typing_warrior cd typing-warrior
-
Modify the Makefile to include the paths to the SDL2 libraries:
INCLUDES = -I<path-to-SDL2-include> LIBS = -L<path-to-SDL2-lib> -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
-
Build the game using make:
make
After successful compilation, run the game using:
./typing_warrior.exe
-
Build Essentials
sudo apt-get install build-essential
-
SDL2 Development Libraries
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev
- Install SDL2 and required libraries using apt-get:
sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev
-
Clone the repository:
git clone https://github.com/RoyDibyaJyoti/typing_warrior cd typing-warrior
-
Build the game using make:
make
After successful compilation, run the game using:
./typing_warrior
For Windows:
INCLUDES = -I<path-to-SDL2-include>
LIBS = -L<path-to-SDL2-lib> -lSDL2 -lSDL2_image -lSDL2_ttf -lSDL2_mixer
For Linux:
INCLUDES = `sdl2-config --cflags`
LIBS = `sdl2-config --libs` -lSDL2_image -lSDL2_ttf -lSDL2_mixer
typing-warrior/
โโโ src/ # Source files
โโโ include/ # Header files
โโโ img/ # Game images
โโโ others/ # Resources (font, word list)
To remove the compiled executable:
make clean
The game requires the following assets to be present in their respective directories:
- Font file (
others/my_font.otf
) - Word list (
others/words.txt
) - Image assets in the
img/
directory - High score file will be automatically created
Feel free to fork the repository and submit pull requests. For major changes, please open an issue first to discuss what you would like to change.
Special thanks to:
- Shawon sir and Taj sir
- SDL2 development team