Course: CS50's Introduction to Game Development
Assignment: Angry Birds — “Three’s Company”
Engine / Language: LÖVE2D (Lua)
This repository contains my implementation of the Angry Birds project from CS50’s Introduction to Game Development.
🐥 Built with LÖVE2D and Box2D, this physics-based projectile game replicates the classic Angry Birds experience where players launch Aliens to destroy obstacles and enemies.
💡 In this version, I implemented the “Three’s Company” feature — giving players the ability to split a launched Alien into three mid-flight for more strategic gameplay.
-
✔️ Alien Splitting Mechanic
- After launching an Alien, pressing Spacebar (before it collides with anything) splits it into three Aliens.
- The center Alien continues its original trajectory.
- The upper and lower Aliens are spawned with slightly altered linear velocities and angles for realistic divergence.
-
✔️ Collision Flag & Split Condition
- Added a collision flag in
Level.luato ensure splitting only occurs before the first impact. - Once any Alien collides with an object, the flag is disabled, preventing multiple splits.
- Added a collision flag in
-
✔️ Launch Marker Behavior Update
- Updated
AlienLaunchMarker.luaso the launch marker resets only when all Aliens (split or original) have nearly stopped moving, ensuring consistent physics handling.
- Updated
-
✔️ Physics Integration
- Leveraged Box2D’s linear velocity vectors to calculate accurate splitting trajectories.
- Maintained realistic motion, gravity, and collision effects for all three Aliens.
-
Install LÖVE2D:
Download and install from LÖVE2D. -
Clone this repository:
git clone https://github.com/huzaifa-gamedev/cs50-angry-birds.git cd cs50-angry-birds -
Run the Game:
love .
| Key | Action |
|---|---|
| Click + Drag | Aim and launch Alien |
| Spacebar | Split Alien into 3 (before first collision) |
| Escape | Quit game |
-
Splitting Logic:
Implemented directly in theLevelclass, triggered vialove.keypressed('space'). Ensures splitting happens only if the active Alien has been launched and has not collided. -
Spawn Offsets:
Created two new Aliens slightly above and below the original Alien’s position using Box2D world coordinates and adjusted linear velocities for natural spread. -
Collision Detection:
UsedWorld:setCallbacks()to detect when the Player Alien hits any object, setting ahasCollidedflag to prevent further splits. -
Game Reset Condition:
Modified the launch reset behavior so the marker reappears only when all three Aliens come to rest (near-zero velocity). -
Physics Consistency:
Ensured each new Alien inherits the same fixture, shape, density, and restitution as the base Alien for consistent simulation results.
- 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 feedback, collaboration, or project ideas, feel free to connect via GitHub.
© 2025 Muhammad Huzaifa Karim. All rights reserved.
