LiamMcKenzie / ScaredKrow

ScaredKrow is a game made for the third year "ID737001 Game Development" paper at Otago Polytechnic
MIT License
1 stars 2 forks source link

Johnathan/camera catchup_gameover threshhold_boundaries #15

Closed JohnathanGlasgow closed 4 months ago

JohnathanGlasgow commented 4 months ago

Camera Catchup

NOTE: Liam and I accidentally implemented camera catchup concurrently. In Liam's implementation, the viewport is used to determine player has entered the speedup area. This is good because it is a relatively cheap calculation compared to the collider I am currently using. The speed then accelerates to the catchup speed. When the player leaves the speed reverts to a hardcoded value matching the initial speed.

I initially used the viewport also, but I did not like the way it would speed up if I moved laterally. That is why I changed to a collider to trigger the speed increase. This way the trigger area is parallel to the rows and can't be triggered with lateral movement. But it's also less efficient. My implementation also stores the speed before the catchup is started, so the speed can be incremented. After seeing Liam's branch, I copied the acceleration idea, and added deceleration as well.

Gameover Threshold

I'm using a collider for the Gameover trigger area. Currently this opens a placeholder Gameover dialog asking player to play again or quit. I did actually end up tilting this to be parallel with the viewport rather than the grid, so using inViewport could be cheaper for this. Although using the collider makes it easy to move and test. On reset, the tile map is regenerated and the player is respawned. Speed is set to its initial value.

Fence Tiles

The fence tiles are determined by the boundaryLeft and boundaryRight fields in the DifficultyProfile. In the TileData class it can be specified if these occur only inside or outside (leave both unchecked for a tile to occur inside and outside the fence). The fence works by storing a reference to the fence prefab in the tiles that might contain a fence, essentially the row tiles like water and road as well as the default tiles. This way they can have their own fence model, ie a gate for the road model. The fence is then instantiated from the TileController where it is given the correct orientation (TileControllerBuildFence()).

JohnathanGlasgow commented 4 months ago

I put the game over trigger on screen because that's where it is in crossy road. But I've moved it anyway.

IMG_6CBC695E8CC8-1

The base speed not increasing during catchup was an oversight on my part. I've refactored the speed code so the actual speed is set to either the base speed (which continues to increment independently) or accelerates/decelerates to the catchup speed depending if catchup is initiated. The base speed continues to increment to the maximum base speed (should be less than the catchup speed). Whereas the catchup speed is effectively the maximum actual speed. The player shouldn't be able to stay in the catchup area so I've tweaked the settings to kick them out faster. But we can continue to adjust this as needed.

JohnathanGlasgow commented 4 months ago

I've also moved the tileOnlyOccursInsideBoundary/tileOnlyOccursOutsideBoundary flags from the TileData scriptable object to the TileProbability struct because that makes more sense and is easier to set up.