preview.mp4
An arcade-based multidirectional tank shooter video game inspired by the *"Battle City" developed by Namco (1985).
This game is developed by Louise Gabriel Vilar and Ethan Mislang as a submission for the CS12 Machine Problem 1 (MP1). It makes use of the Pyxel, a retro game engine for python.
The specifications can be found in this Notion page Specs
A video demonstration of the final game is in this Google Drive folder: Video Demo
Note: the phases that the group was able to achieved are PHASE 1 - PHASE 3 (Completed all requirements)
To run the game, please install Python and Pyxel first and run the following commands:
python main.py
-
W: Move up one cell -
A: Move left one cell -
S: Move down one cell -
D: Move right one cell -
SPACEBAR: Shoot bullets -
SPACEBAR(Hold): Shoot bullets for fastest allowed rate of fire -
SPACEBAR(REPEAT): Shoot bullets in succession for fastest allowed rate of fire
CTRLorControl: Reset gameEscorEscape: Stops the program (analogous to quit game)EnterorReturn: Starts the game (if on the title screen), respawns the player (if already in game)
This implementation contains a cheat code. Typing the string
OSTEP
at any point will give the player one (1) life.
The objective of the game is to kill all Enemy Tanks within the alloted time of 2-minute per Stages. There are designated spawn points for enemies in the map, and the spawners cannot be killed. There is also a Home Cell, wherein if it is destroyed, the game is immediately over for the player regardless of Token and Lives left.
Environment helps for the current display and transition of the game. Includes the following:
# Environment Variables
SCENE_TITLE = 0
SCENE_PLAY = 1
SCENE_GAMEOVER = 2
SCENE_VICTORY = 3
Most entities in the game go through Pyxelgrid, aside from the PlayerBullets, EnemyBullets, EnemyLandmine and other assets.
They map layout of each stage is specified in their own respective text file. The acronyms are as follows:
- "--" - Empty Cell
- "PL" - Player
- "HO" - Home cell
- "PO" - Powerup
- "SP" - Enemy Spawn
- "E1" - Enemy 1
- "E2" - Enemy 2
- "ST" - Stone
- "WA" - Water Block
- "FO" - Forest Block
- "BR" - Regular Brick
- "CR" - Cracked Brick
- "NE" - Northeast Leaning Mirror
- "SE" - Southeast Leaning Mirror
- "GR" - Grass
- "LG" - Left grass
- "TR" - Trees
- "DO" - Door
There are a few requirements for the game to run properly. There must be at least one enemy in the map at initialization, there can only be one spawner, and there can only be one player tank.
As the player, you control a blue-colored tank.
-
Pressing [SPACEBAR] allows the Player Tank to shoot PlayerBullets. Such PlayerBullets travels around 4 C/s (Cell per second)
-
The player tank has give (1) Lives for each insertion of Token at the start of the game.
-
By default, player is given (2) Token that can be used to respawn whenever PlayerTank dies from EnemyBullets or EnemyLandmine
Each Stage has respective number of enemy presence in the map. The following are the (2) Two types of Enemy Tanks.
-
RegularEnemyTank are the counterpart of the PlayerTank. They are simple AI-controlled that moves and shoots EnemyBullet randomly at a given frame. PlayerTank are neither allowed to pass through the EnemyTanks nor be damaged when adjacent to them.
-
Similar to RegularEnemyTank, LandmineTank are hostile EnemyTank but rather than firing EnemyBullets, these tanks plant EnemyLandmine on their position
-
- Features all required cells in phase 3
- Added other assets like doors, grass, and trees
-
- Features all required cells in phase 3
- Added other assets like doors, grass, and trees
-
- Features all required cells in phase 3
- Added other assets like doors, grass, and trees
The following are the sounds designed by Ethan Mislang using Pyxel Editor
The sprites and assets are designed by Louise Vilar using Pyxel Editor.
resources.pyxres
class GameState:
player_lives: int
game_token: int
player_is_alive: bool
is_game_over: bool
is_victory: bool
is_reset_game: bool
is_pause_game: bool
is_death_pause: bool
is_game_end: bool
stage: int
stage_time: int
scene: int
GameState, being a dataclass allows us to stack several in-game settings to control the current state of the game.
-
Upon inserting a Token into the game, Timer of 2-minutes immediately starts. There are 2-minute alloted time for each Stage. When the PlayerTank is either Dead or the player pressed Pause the Timer stops and blinks to signal the player with the current time. When player pressed Enter/Return Timer will immediately Resume with the time it left off.
-
Timer in HUD turns red when the time reaches the 30-second mark.
If the timer runs out for each Stage the game immediately ends with GameOver even if the player still have Lives or Token left.
-
In SCENE_PLAY, players are guided and updated with sidebar that contains the basic HUD for Lives, Timer, EnemyCount, and Token.
With each member unwavering effort and hardwork, Battle(C)ity is made possible. Herewith are the following contributions of members:
MISLANG, Ethan Renell Sebastian
- Pyxel Resources (Sound Design)
- Staging Mechanics (Including transitions)
- In-game Logic
- EnemyTank and LandmineTank
- Video Presentation
- Readme.md Formatting
VILAR, Louise Gabiel R.
- Pyxel Resources (Sprites, Text, Map Design)
- Environment and PyxelGrid Integration
- PlayerTank
- Miscellenaous Features (Timer)
- Bullet Collision & Mirror Detection
- Gamestate Setting
- Cheatcode
- Readme.md Formatting