Week 5 - Simple Game
Firstly this week, I created an empty game object and added the spawner script provided to create a spawner in the scene. I duplicated it, adding a spawner into each corner of the scene below:
I had some difficulties making the trigger detection script work as couldn't figure out how to use the Unity events on a prefab to alter an object in the scene. I made some slight alterations to the script to allow the reduction in the health in the PlayerHealth script as well as destroying the enemy when contact happens.
I also added the health packs to the scene. I used the barrel model that I created earlier in the semester for this task. The trigger detection exists on the player and adds 3 to the health when the player triggers an object that has the tag "HealthPack". This can be seen below:
Finally, I added an end of game, which occurs when the players health . The code controlling this exists in the PlayerHealth script, which checks to see if the player's health is less than or equal to 0, which sets the character as inactive and sets a canvas text active stating "Game Over!".
UTAS KIT207 Portfolio
More posts
- Week 5 - Game IdeasApr 05, 2024
- Week 4 - NavigationApr 04, 2024
- Week 4 - TerrainMar 22, 2024
- Week 3 - animations in unityMar 21, 2024
- Week 3 - animationsMar 17, 2024
- Week 2 - simple sceneMar 14, 2024
- Week 1 - Barrel and BridgeMar 10, 2024
Leave a comment
Log in with itch.io to leave a comment.