Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/cuongvnz/spooky_halloween
2D shooter game - a custom program in Ruby for COS10009
https://github.com/cuongvnz/spooky_halloween
game-physics ruby
Last synced: 1 day ago
JSON representation
2D shooter game - a custom program in Ruby for COS10009
- Host: GitHub
- URL: https://github.com/cuongvnz/spooky_halloween
- Owner: CuongVnZ
- Created: 2022-12-17T08:28:07.000Z (about 2 years ago)
- Default Branch: master
- Last Pushed: 2022-12-17T10:31:37.000Z (about 2 years ago)
- Last Synced: 2024-11-14T17:39:58.628Z (2 months ago)
- Topics: game-physics, ruby
- Language: Ruby
- Homepage:
- Size: 860 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Spooky Halloween
A simple 2D zombie survival game written in Ruby using the Gosu library. Players must survive waves of zombies and pick up items such as ammo and health to help them survive. The game is over when the player's health runs out.
## Requirements- Ruby
- Gosu `(gem install gosu)`
- Halloweenpixels & Squares font (included in `attachments` directory)## Running the game
To run the game, simply execute the file in Ruby:
``` sh
ruby spooky_halloween_structured.rb
```## Gameplay
In the game, you play as a survivor trying to survive waves of zombies. Use the WASD keys to move and the mouse to aim and shoot. Pick up items such as ammo and health to help you survive. The game is over when your health runs out.
The game features several screens including a main menu, a play screen, a round screen, a game over screen, a profile screen, a high score screen, and an instruction screen.
The player has a maximum health of `PLAYER_MAX_HEALTH` and a maximum ammo of `PLAYER_MAX_AMMO`. The player's default velocity is `PLAYER_DEFAULT_VELOCITY`.
Zombies have a dimension size of `ZOMBIE_DIMENSION_SIZE_X` by `ZOMBIE_DIMENSION_SIZE_Y` and a default velocity of `ZOMBIE_DEFAULT_VELOCITY`. Their round multiplier is `ZOMBIE_ROUND_MULTIPLIER` and their default health is `ZOMBIE_DEFAULT_HEALTH`. Zombies are knocked back by `ZOMBIE_KNOCKBACK` units and their size is `ZOMBIE_SIZE` times their default size.
Bullets have a velocity of `BULLET_VELOCITY`.
## ConfigurationSeveral game settings such as player and zombie attributes can be modified by changing the values of the global constants at the top of the file. The game can also be set to debug mode by setting the `DEBUG` constant to `true`.
## Classes and ModulesThe game consists of several classes including `Player`, `Zombie`, `Bullet`, `Item`, and `Scheduler`. The `ZOrder` and `Screen` modules are also used.
The `Player` class has attributes for location, health, ammo, dimensions, and a flag for whether the player is dead. It also has an attribute for the mouse vector, which represents the direction the player is aiming.
The `Zombie` class has attributes for location, a direction vector, health, dimensions, and a flag for whether the zombie is dead.
The `Bullet` class has attributes for location, a direction vector, and dimensions.
The `Item` class has attributes for location, type, and dimensions. The `DropType` module defines constants for the types of items that can be dropped.
The `Scheduler` class has attributes for a time and a proc (a block of code). It is used to schedule events to occur after a certain time has passed.
The `GameWindow` class is the main class for the game and is responsible for handling input, updating the game state, and rendering the game. It is a subclass of Gosu::Window and overrides several methods from the parent class.
## MediaThe game uses images and fonts for its graphics and UI. The images and fonts are stored in the media directory.
![alt text](/attachments/1.png)
![alt text](/attachments/2.png)
## Credits- Squares font by Neon22
- Halloweenpixels font by pizzadude
- Menu background image by PNG Fuel
- Game background image by Free PNGs
## LicenseThis project is licensed under the MIT License. See the LICENSE file for details.