Devlog 7: Simple Game [UPDATED]
The task for this devlog was to turn the scene we created last week into a simple game.
We were provide with some scripts to help us complete this task. One of them was a simple spawner script that would spawn enemies at regular intervals until x number of enemies have been spawned. The other was a player health script that would keep track of the players health.
The first task was to take the spawner script and add it to an empty game object, then link up the agent prefab to the spawner script. Now we had a working enemy spawner.
(Enemy Spawner)
The next task was to add in the Trigger Detection script we used in a previous devlog so that when an enemy agent comes into contact with the player, the enemy agent dies/disappears and the players health is reduced. This once again was achieved by using Unity Events.
(Enemies dying)
At the current point in time, the health script isn't working for whatever reason so the players health doesn't change. This will be remedied in the near future and this devlog update when it is.
Next was to add health pack into the scene. These would have the effect of increasing the players health by a set amount. After the player collects the health pack, the health pack will disappear.
(Player collecting a health pack)
As with the above enemies, the health doesn't change for some reason.
The last task was to destroy the player when their health reaches 0 and display a message and a particle effect when this occurs. This was achieved by adding some code to the health script that detects when the players health reaches 0, which then triggers the explosion and the player to disappear.
UPDATE
After a lot of trial and error, I have managed to work out what was why the scripts were not behaving like I expected them to. In the gif below you can see the enemy agents trying to follow the player by going up the stairs and traversing the platform. At the same time you can see the player collect a health pack and gain 5 health points.
(Enemy pathfinding and health pack interaction)
An in this next gif you can see whenever an agent collides with the player, the players health will decrease by 1 point and the outsides of the screen will flash red to give a visual indication that the player has taken damage. Once the players health hits 0, a simple game over screen is displayed to signify the players death.
(Player damage and gameover)
Finally we added in some particle effects that are triggered when the players health reaches 0.
(Explosion upon player death)
UTAS KIT207 - Portfolio
A collection of posts as part of KIT207 University Course
More posts
- Devlog 10: Cinemachine and Post ProcessingAug 18, 2022
- Devlog 9: Shadergraphing and LightingAug 16, 2022
- Devlog 8: Game IdeasAug 09, 2022
- Devlog 6: NavigationAug 09, 2022
- Devlog 5: Terrain and ProBuilderAug 02, 2022
- Devlog 4: Unity and Im/Ex-porting AnimationsJul 28, 2022
- Devlog 3: Bone-imationJul 26, 2022
- Devlog 2: ImportingJul 21, 2022
- Devlog 1: Blender-ing?Jul 19, 2022
Leave a comment
Log in with itch.io to leave a comment.