Posted May 08, 2023 by dannmosny
Activity:
- implemented water shooting as a way to extinguish fires
- added place where player can refill water
- made the amount of water player has affect his speed
- added game over screen when player touches fire
Notes:
Setting up the water shooting was more tricky than I expected. I made the water shoot in the direction of the mouse but this was working very inconsistently. The problem was I wasn't converting the "camera coordinates" to "world coordinates". After I solved this problem I encountered another one: even though I was normalizing the speed of the water, the speed kept varying. Some debugging later I realised that calculating the speed from the position of the mouse made the water to sometimes move in the unseen Z dimension.
When making the place where players refills water (hydrant/well) I needed to detect collisions with the player but didn't want them to collide - I had to learn how to use the "IsTrigger" option of colliders. I also learned how to make a game over screen.
Invested hours:
- programming new mechanics: 4 hours