đ Features
- đšī¸Multiple Plants: Peashooter, Sunflower, Wallnut, Snowpea, Cherrybomb, Repeater.
- đ§Zombies: Waves of zombies with unique attack and movement patterns.
- âī¸Combat: Plants generate attacks (peas, slowing peas, explosions, etc.) and zombies attempt to reach the house.
- đ§ŽScoring: Points for defeating zombies and surviving waves.
- đĄī¸Lawnmowers: Last-resort lane-clearing defense.
đī¸ Design & Patterns
This project uses strong OOP principles and design patterns for a clean, extensible architecture.
- Factory Pattern:
PlantFactory
andZombieFactory
produce game entities. - Inheritance & Polymorphism: Base
Plant
andZombie
classes â derived classes override behavior. - Composition:
Level
manages plants, zombies, UI and orchestrates interactions. - Encapsulation & Abstraction: Rendering, collision detection and updates are encapsulated in dedicated components.
đ§ą Project Structure (UML-based)
Core classes & responsibilities:
- Levels â Manage gameplay loop: placement, event handling, collisions, updates.
- PlantFactory / ZombieFactory â Instantiate plants and zombies.
- Plant (base) â Attributes: health, cost, drawing, attack/grow/takeDamage.
- Derived Plants â Peashooter, Snowpea (slow), Repeater (double), Sunflower (resource gen), Cherrybomb (area explosion), Wallnut (shield).
- Zombie (base) â Movement, attack, health; e.g., SimpleZombie derived class.
- Lawnmower â Clears a lane on trigger.
- Attack / Move â Utility classes for movement & attack mechanics.
- Score â Tracks and displays player score.
đ§ Tech Stack
Technology | Purpose |
---|---|
C++ | Core language and OOP implementation |
SFML | Graphics, window management, audio, and events |
Design Patterns | Factory, Inheritance, Polymorphism, Composition |
đŽ How to Play
- Select a plant from the inventory panel.
- Place the plant on the lawn grid (valid cells only).
- Plants auto-attack or generate resources; zombies approach in waves.
- Earn points by defeating zombies and survive waves to win.
đ Future Improvements
- More plant & zombie types with unique behaviors.
- Full resource (sun) generation & management system.
- Background music, sound fx, and polish.
- Multiple levels, level progression, and difficulty scaling.
đ Authors & Credits
- Developed as a C++ OOP + SFML project (author(s) / contributors: add names here)
- Assets: custom or royalty-free (replace with actual credits where needed)
đĻ Repository
đ View on github
Academic / Showcase Project