Laboratory Initialization - UQcsse3200/2023-studio-2 GitHub Wiki
Overview
Laboratory create a Laboratory for the player and companion to access and spawn different powerups to assist the player.
Design
Laboratory asset was selected to fits the overall Game Design objective.
Gameplay
When a player or companion approaches a powerup and presses M
key, the lab window pops up. player can spawn particular powerups through this lab window.
Usage
Initialisation:
- Initialise a new
LaboratoryFactory
- Addition of physics components.
- Toggle the lab window.
Example:
Entity laboratory = new Entity()
.addComponent(new TextureRenderComponent(config.spritePath))
.addComponent(new ColliderComponent().setLayer(PhysicsLayer.LABORATORY))
.addComponent(new PhysicsComponent().setBodyType(BodyDef.BodyType.StaticBody))
.addComponent(new HitboxComponent().setLayer(PhysicsLayer.LABORATORY))
.addComponent(new CombatStatsComponent(4, 0, 0, false));
Spawn Laboratory:
private void spawnLaboratory(){
LaboratoryConfig laboratoryConfig = mapConfig.areaEntityConfig.getEntity(LaboratoryConfig.class);
if (laboratoryConfig !=null){
Entity newLaboratory = LaboratoryFactory.createLaboratory();
spawnEntityAt(newLaboratory, laboratoryConfig.position, true,false);
}
}
#UML