-
Notifications
You must be signed in to change notification settings - Fork 9
Wall
The Wall
class is a placeable entity within the game. It is responsible for creating and managing wall entities which can be placed/upgraded/removed in the game environment. It blocks players and other entities from walking through but maintains sightline for enemies so enemies will try and break it if they are targeting an entity on the other side. There are currently two variants of walls, Dirt and Stone walls.
Players can place a dirt wall by selecting it via the StructureToolPicker
and then left clicking anywhere within the game map. A wall must be placed on an even tile to make it easier to place walls in line with each other. Placing a wall will consume 2 unobtanium.
Players can upgrade a wall by left clicking on it. Currently there are two wall variants, dirt and stone. If you left-click on a dirt wall it will be replaced with a stone wall. If you left click on a stone wall, nothing will happen since there is no higher tier. Upgrading a wall will consume 2 unobtanium.
Players can destroy a wall by right-clicking on its location. This will immediately destroy the wall and return 2 unobtanium to the player.
Players can heal a wall by left-clicking on a damaged wall. The health of each wall will show up when a player is nearby.
The wall class inherits the Entity class and uses the following components.
- PhysicsComponent - necessary to provide the wall collision.
- CollidorComponent - provides the wall with it's collision.
- CombatStatsComponent - provides the health of the wall.
- HealthBarComponent - provides a health bar popup for the wall.
- JoinableComponent - allows neighbouring walls to alter the texture and collision box of the wall.
This UML doesn't include any of the functions and properties of the other classes. It is mainly for the purpose of showing the relationship between each Class the Wall uses.
com.csse3200.game.entities.buildables.Wall
The purpose of the Wall
class is to spawn and manage individual wall entities within the game world.
Walls are objects that occupy a single tile on the map and connect to each other when placed adjacent to each other.
The wall has different health based on level ie. 'basic', 'intermediate'
Health The health and wall type can be changed in 'configs/wall.json'.
entity.getEvents().addListener("place", this::placeOrUpgradeWall);
where placeOrUpgrade places the wall and upgrades it.
Wall type is returned using GetWallType()
.
The wall was tested by placing and creating a grid of walls to check every possible connection pattern is working correctly. We also tested the collision by having the player walk around the perimeter of each connection variety to ensure the shape was correctly defined.
JUnit testing is planned to be implemented next sprint once we have a more solid understanding of using Mockito for testing.
Escape Earth Game
Interaction Controller and Interactable Components
Game and Entity Configuration Files
Loading Game Configuration Files