Class CollectableFactory
java.lang.Object
com.csse3200.game.entities.factories.CollectableFactory
Factory for creating collectable entities (e.g., keys, coins, potions).
-
Method Summary
Modifier and TypeMethodDescriptionstatic EntitycreateCollectable(String itemId) Creates a new collectable entity instance based on its configuration ID.
-
Method Details
-
createCollectable
Creates a new collectable entity instance based on its configuration ID.The returned entity includes:
- A static
PhysicsComponentandColliderComponentconfigured as a sensor obstacle. - A
CollectableComponentto handle collisions and inventory logic. - Visual representation from either an animated
AnimationRenderComponentif a sprite atlas is provided, or aTextureRenderComponentfor static images. - A
ConeLightComponentfor a visual backlight effect.
- Parameters:
itemId- the identifier of the collectable, as defined initems.json- Returns:
- a collectable
Entity - Throws:
IllegalArgumentException- ifitemIdis not registered
- A static
-