Skip to content

RoyDibyaJyoti/typing_warrior

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

9 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

Typing Warrior ๐Ÿš€

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!

๐ŸŽฎ Game Features

  • 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)

๐Ÿ› ๏ธ Prerequisites

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)

๐Ÿ“ Project Structure

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

๐ŸŽฏ Gameplay

  1. Main Menu

    • Choose between Play and Exit options
    • Simple and intuitive interface
  2. 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
  3. 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

๐Ÿš€ Controls

  • A/Left Arrow: Move spacecraft left
  • D/Right Arrow: Move spacecraft right
  • SPACE: Shoot
  • Keyboard: Type words to destroy asteroids
  • ESC: Return to menu

๐Ÿ”ง Installation

MacBook

Prerequisites

First, ensure you have the following installed on your MacBook:

  1. Xcode Command Line Tools

    xcode-select --install
  2. Homebrew (Package Manager)

    /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

Installing Dependencies

  1. 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

Building the Game

  1. Clone the repository:

    git clone https://github.com/RoyDibyaJyoti/typing_warrior
    cd typing-warrior
  2. Build the game using make:

    make

Running the Game

After successful compilation, run the game using:

./typing_warrior

Troubleshooting

If you encounter any issues:

  1. 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
  2. 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
  3. Library Linking Issues

    • Verify the library paths:
      brew --prefix sdl2
    • Make sure the paths in the Makefile match your system

Windows

Prerequisites

  1. MinGW (Minimalist GNU for Windows)

    • Download and install from MinGW
  2. SDL2 Development Libraries

    • Download SDL2, SDL2_image, SDL2_ttf, and SDL2_mixer development libraries from libsdl.org

Installing Dependencies

  1. Extract the SDL2 libraries and place them in a known directory.

Building the Game

  1. Clone the repository:

    git clone https://github.com/RoyDibyaJyoti/typing_warrior
    cd typing-warrior
  2. 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
  3. Build the game using make:

    make

Running the Game

After successful compilation, run the game using:

./typing_warrior.exe

Linux

Prerequisites

  1. Build Essentials

    sudo apt-get install build-essential
  2. SDL2 Development Libraries

    sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev

Installing Dependencies

  1. Install SDL2 and required libraries using apt-get:
    sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-ttf-dev libsdl2-mixer-dev

Building the Game

  1. Clone the repository:

    git clone https://github.com/RoyDibyaJyoti/typing_warrior
    cd typing-warrior
  2. Build the game using make:

    make

Running the Game

After successful compilation, run the game using:

./typing_warrior

Makefile Changes

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

Directory Structure

typing-warrior/
โ”œโ”€โ”€ src/               # Source files
โ”œโ”€โ”€ include/           # Header files
โ”œโ”€โ”€ img/               # Game images
โ””โ”€โ”€ others/            # Resources (font, word list)

Cleaning Build Files

To remove the compiled executable:

make clean

๐ŸŽจ Game Assets

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

๐Ÿ“ Contributing

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.

๐ŸŽฎ Game Screenshots

menu main main score board

๐Ÿ™ Acknowledgments

Special thanks to:

  • Shawon sir and Taj sir
  • SDL2 development team

Our Team:

About

Project for my 1-1

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published