Door Factory and Door Call Back - UQcsse3200/2024-studio-1 GitHub Wiki
The DoorFactory
class is designed to create a door entity with the required collisions, assets, orientation and 'DoorCallBack' to its instantiation in a chosen game area.
Key Components
DoorFactory
- responsible for creating and returning a door entity that can be used to transition between rooms
DoorCallBack
- responsible for the callback that is used to transition between rooms
Usage
The door is used by creating it within a chosen game area. The user can create a door by
Entity door = DoorFactory.createDoor('v', callback);
Where the v
character is standing for the orientation of the door entity, and the callback is of type DoorCallBack
that currently is an interface with only onDoorCollided
method.
This would create a door with a pink image asset (to be changed in next sprint to corresponding theme) to visually display the door that when the entity collides with the door the callback is triggered.