Skip to content

BillyHsieh123a/111_1_Programming_Design_Game_Development

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

54 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NIGHTMARE

NIGHTMARE is a retro-style, console-based single-player action game written entirely in C++.

Players navigate a maze-like map, collect items, push movable blocks, and avoid or eliminate enemies to reach the goal.


📜 Game Overview

In NIGHTMARE, you control a character using the keyboard to move across a grid-based map.

Your mission is to reach the goal while keeping your health above zero, collecting as many points as possible along the way. The game is displayed in ASCII graphics inside the console window, with different colors for walls, enemies, items, and the player.


🎮 Gameplay

Controls:

  • W / A / S / D → Move Up / Left / Down / Right
  • E → Shoot (consumes 1 bullet)
  • Q → Quit game
  • SPACE → Continue / skip text in menus and ending scenes

Objectives:

  • Survive until you reach the goal (Health > 0).
  • Collect bullets, health packs, and score items.
  • Avoid or destroy enemies.
  • Use movable walls strategically to block enemies or clear paths.

Win Condition: Reach the goal alive. Lose Condition: Health drops to zero.


🗺️ Map & Objects

The map is stored in a 2D array, where each number represents a type of object:

Code Object Description
-2 Goal Reaching this wins the game
-1 Player Controlled by you
0 Empty Space Can move through
1 Fixed Wall Cannot be moved or destroyed
2 Bullet Supply (B) +1 bullet
3 Health Pack (H) +1 HP
4 Score Item ($) +1 score
5 Movable Wall Can be pushed or destroyed
≥90 Enemy ID distinguishes enemy type
-99 Dead Enemy Marker Enemy disappears

👾 Enemies

There are three enemy movement types:

  • Clockwise – Turns right when hitting an obstacle.
  • Counterclockwise – Turns left when hitting an obstacle.
  • Random – Moves unpredictably.

Enemy Behavior:

  • Contact with the player reduces the player’s health by the enemy’s attack value and removes the enemy.
  • Enemies avoid picking up items but will “remember” items they pass over and restore them when leaving.

🛠️ Technical Details

  • Language: C++
  • Graphics: Console ASCII rendering with Windows console functions for color.
  • Core Classes:
    • Position – Stores coordinates and supports operator overloading.
    • Player – Handles player movement, shooting, and item collection.
    • Enemy (abstract) – Base class for enemy types.
    • EnemyClockwise, EnemyCounterclockwise, EnemyRandom – Derived enemy classes implementing different movement patterns.
    • EnemyTeam – Manages all active enemies.
  • Map Representation: Static 2D array with object codes.
  • Threading: Used for music playback (optional, Windows only).

📦 Installation & Running

Requirements:

  • Windows OS (due to windows.h and console color handling)
  • C++ compiler (e.g., MinGW, MSVC)

Compilation:

g++ main.cpp -o nightmare

🎵 Music

  • Created with LMMS.
  • Played in parallel with game execution using PlaySound() and thread.

🚀 Future Improvements

  • Display enemy HP and attack strength visually (e.g., colors).
  • Allow player and enemies to move simultaneously while bullets are in motion.
  • Better scaling of map elements for console display.
  • Additional enemy and item types (e.g., ranged enemies, shields).
  • Achievement system.

👥 Credits

Team H – Program Design Final Project (111-1)

  • 周昀蓉 – Documentation, Video Production
  • 謝友毅 – Programming (60%), Documentation
  • 林澐稚 – Programming (40%), Documentation
  • 李盈盈 – Video Production, Documentation

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors