Submission 2: Aggregation
Objective: Demonstrate aggregation by incorporating objects within other objects.
Instructions:
Create an
Item
Class:Attributes:
String name
int healthBoost
int attackBoost
Constructor: Initialize the item's properties.
Modify the
Player
Class:Add an attribute:
Item equippedItem
Methods:
void equipItem(Item item)
Update
attack(Enemy enemy)
to includeattackBoost
if an item is equipped.
Modify the
Enemy
Class:Enemies can drop items upon defeat.
Methods:
Item dropItem()
Implement Item Usage in the Game Loop:
Allow the player to equip items dropped by enemies.
Update combat mechanics to reflect item boosts.
Deliverables:
Updated source code files.
Screenshot of the program running
COSC-1437 / ITSE-2457 Computer Science Dept. - Author: Dr. Kevin Roark