Package com.mg105.entities
Class TreasureChest
java.lang.Object
com.mg105.entities.TreasureChest
TreasureChest is a class representing the treasure chests in the game. Unopened chests contain an item.
-
Constructor Summary
ConstructorDescriptionTreasureChest
(Item reward, Point position) Create a new treasure chest at a position with a certain reward. -
Method Summary
-
Constructor Details
-
TreasureChest
Create a new treasure chest at a position with a certain reward. Note that none of these should be null.- Parameters:
reward
- the reward for opening the chest.position
- the in-room position of the chest.
-
-
Method Details
-
getPosition
Gets the position of the treasure chest.- Returns:
- the position of the chest.
-
open
If unopened, this will open the chest and return the reward.- Returns:
- the reward of the chest.
-
isOpened
public boolean isOpened()Gets if this chest has been opened.- Returns:
- true if this chest has been opened, false otherwise.
-