Bench Upgrade - UQcsse3200/2024-studio-3 GitHub Wiki
This wiki will outline the design decisions involved with the grid layout and bench upgrades.
Grid creation
Bench tile design
We started off by creating this tile to simply test if we would be able to string multiple of them together to create a bench. This is a 2x2.
Change of plans
The initial plan was to create a grid in order to place the benches. The idea was to create something similar to the tiles being created in the TerrainFactory
. So we tried creating a new type of tile called Bench and implementing it by adding into the layer being created the same way I created the Customer Tiles
when we implemented the blue area for customers. A function was added called create_bench_grid. However, after spending a few hours doing this, we realised the inefficiency of the idea. It would created issues when having to deal with collisions and we also realised that the benches should not be created the same way floor tiles are. This is because Benches are objects/obstacles and hence should not be part of the terrain. It would be more suitable to create them on top of that terrain being created. The initial commits on the team7-bench branch are attempts of this implementation. This took a significant amount of time since we spent a couple of days trying to create the benches in that class to only realise that it was not the way to go.
Modifying ForestGameArea
We decided to switch into adding the bench tiles into ForestGameArea. Multiple bench designs had to be created to create a layout similar to what we had in the first sprint. Here are a few examples:
These were all created using photoshop by our team (similarly to the new player sprite that we created).
The Bench.java
class was completely rewritten by removing most of what was written since they were no longer needed. All that is being done in this class is mostly creating components like PhysicsComponent
and ColliderComponent
. The benches were spawned by adding multiple tiles next to each other (setting the coordinates was pretty simple due to the size of a bench tile fitting a floor tile). Once this was done we were able to create whole benches. This code demonstrates the use of the helper functions. The helper functions call createBench
which is a function in the Bench class.
`private void spawnBenches(){ spawnSingleBench("left_border", 4, 1f); spawnBenchRow("middle", 5, 14, 1f); spawnSingleBench("right_border", 15, 1f);
// Top shadow bench row
spawnBenchRow("shadow_bottom_top", 5, 14, 10f);
spawnSingleBench("left_shadow", 4, 10f);
// Middle vertical benches (long bench setup)
spawnSingleBench("single", 9f, 10f); // Middle part of long bench
spawnBenchColumn("vertical", 9f, 7, 9); // Middle vertical section
spawnSingleBench("left_corner_shadow", 9f, 7f); // Bottom-left corner shadow
// Top horizontal shadows near middle
spawnBenchRow("top_shadows", 10, 12, 7f);
// Long bench bottom part (left shadow + right shadow)
spawnSingleBench("left_corner_shadow", 11, 3f);
spawnSingleBench("top_shadows", 12, 3f);
spawnSingleBench("right_corner_shadow", 13, 3f);
// Right side of long bench (vertical and top fin)
spawnSingleBench("top", 13f, 7f);
spawnBenchColumn("vertical", 13f, 4, 6);
// Left side of long bench (final vertical + top fin)
spawnSingleBench("vertical", 11f, 4f); // Left vertical part of the long bench
spawnSingleBench("top", 11f, 5f); // Top left fin for long bench
// Right vertical bench column
spawnBenchColumn("vertical", 15f, 2, 9);
spawnSingleBench("top", 15f, 10f);
// Left vertical bench column
spawnBenchColumn("vertical", 4f, 4, 6);
spawnSingleBench("bottom_shadow", 4f, 3f);
spawnSingleBench("top", 4f, 7f);
// Middle long bench (vertical section)
spawnBenchColumn("vertical", 9f, 2, 4);
spawnSingleBench("final", 7f, 3f);
spawnSingleBench("top", 9f, 5f);`
We modified the spawnBenches
function as well as added two helper functions that create a row and column of benches when the same tile as t be used multiple times. These functions can be found in ForestGameArea
.
Modifying the game layout and adding extra benches
After adding all the benches that were in the first sprint, we decided to consider the feedback we got and add more benches to make the map more difficult to navigate through. Multiple designs were tested by looking at them visually but also by having to user move around. We were also able to get items to sit on the bench. We also had to make sure this was a seamless integration with the new border being fixed (in terms of collisions) as well as the new player sprite that we had created. Found below is the new layout of the benches allowing for more possibilities for stations to be placed.