Course: CS50's Introduction to Game Development
Assignment: Legend of Zelda
Engine / Language: LÖVE2D (Lua)
This repository contains my implementation of the Legend of Zelda assignment from CS50's Introduction to Game Development.
🕹️ Inspired by the NES classic, this project enhances the dungeon-crawling adventure with hearts, pots, and throwable weapons, expanding gameplay depth and survival mechanics.
📺 You can also watch my gameplay demo on YouTube.
- ✔️ Heart Drops — Enemies sometimes drop hearts on defeat. Picking one up restores a full heart without exceeding the health cap.
- ✔️ Pot Objects — Randomly spawned pots in the dungeon that the player can:
- Pick up (changes animation to carrying state).
- Cannot swing a sword while carrying.
- ✔️ Pot Throwing Mechanic — While carrying:
- Player can throw the pot in the direction they face.
- Pot travels up to 4 tiles or until it collides with a wall or enemy.
- On hitting an enemy → deals 1 damage and disappears.
- On hitting a wall → disappears.
-
Install LÖVE2D.
-
Clone this repository:
git clone https://github.com/huzaifa-gamedev/cs50-legend-of-zelda.git cd cs50-legend-of-zelda -
Run the game:
love .
- Arrow Keys (↑ ↓ ← →) — Move Link.
- Spacebar — Swing sword (if not carrying a pot).
- Enter/Return — Pick up pot (when facing one).
- Enter/Return (while carrying) — Throw pot.
- Escape — Quit game.
- Hearts: Implemented as
GameObjectwithonConsumecallback. Added healing logic with cap at 6 health (3 hearts). - Pot Pickup: Added PlayerCarryingPotState that locks sword usage and updates animations.
- Pot Throwing: Extended
GameObjectwith projectile behavior usingdx,dy, and max distance logic. - Collision Handling: Pots interact with walls and enemies, disappearing or damaging appropriately.
- Integration: Modified
Dungeon,Player, andGameObjectclasses to support new mechanics smoothly.
- Original skeleton code & assets: CS50's Introduction to Game Development (Harvard). Licensed under CC BY-NC-SA 4.0.
- This implementation: © 2025 Muhammad Huzaifa Karim. Licensed under the MIT License.
For more details, see ATTRIBUTION.md.
Muhammad Huzaifa Karim
GitHub Profile
For ideas, feedback, or collaboration, feel free to reach out via GitHub.
© 2025 Muhammad Huzaifa Karim. All rights reserved.
