-
Notifications
You must be signed in to change notification settings - Fork 9
Laboratory Initialization
atharvagupta2003 edited this page Oct 4, 2023
·
9 revisions
Laboratory create a Laboratory for the player and companion to access and spawn different powerups to assist the player.
Laboratory asset was selected to fits the overall Game Design objective.
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.
- 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
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files