(Devlog 7) Core Mechanic and UI Update
Core Mechanic and UI Update
I decided to finally implement the most complicated function in Paranormal Pursuit, which was the ghost selection mechanic, this mechanic is responsible for the game recognizing which ghost variant is haunting the location, and based on that variable, give a conclusion to the player if they guessed the correct answer or not.
In addition to the core mechanic I added on to the user interface in the game to accommodate a section where the player can select what ghost variant they think is correct. I added this into ghost encyclopedia, specifically a second page to the book.
Core Mechanic Implementation
I made a game object and called it 'Ghost Scanner' and attached 3 scripts to it, each script represents each different ghost prefabs that can be randomly spawned into the game. The way the script works is you write the tag that the ghost prefab uses into the scripts inspector 'Tag' field, and the script will scan for an object in the game with that tag, if it detects an object using that tag it sets the specified button in the inspector to true, if it does not detect an object with the specified tag it sets the specified button to false. If the button is set to true, on the click of the button, it loads a scene telling the player they chose the correct option if the player clicks the button that has not detected any objects with the specified tag it loads a scene telling the player they chose the wrong option. There are 3 scripts that control each ghost and related button.
User Interface Update
In addition to the implementation of the core mechanic I hade to create the buttons so the player can select which ghost they think is the correct option. I decided to put these buttons on a second page of the ghost encyclopedia. I also added some other UI features like the in game menu with a user guide panel in it and a map you can toggle on and off.
Challenges
One challenge I faced that took me a while to figure out why it was happening was the way the script was set up to scan for objects with a specified tag. The way it was set up is that every 5 seconds it would scan for a prefab with the specified tag, which meant it would only set the button to true when the ghost was actively hunting, so when you chose the correct option when the ghost wasn't hunting you it would tell you that you guessed incorrectly. I fixed this by editing the script so it only scans once with a 3 second delay, now when the ghost is spawned at the start of the game, three seconds later the scanner script will detect the ghost and remember that it exists in the scene relative to if it gets despawned or not.
Future Changes
In the future I want to make the spawner not spawn the prefab immediately so it gives the player some time to figure out the controls and objective, however, when I do this I will have to set the scanner scripts scan delay so that it scans after the prefab is spawned other wise it won't detect the ghost at all.
Paranormal Pursuit (Beta v0.3)
2D Top Down Horror Game
More posts
- Game Testing SessionMay 31, 2024
- (Devlog 9) Open Beta ReleaseMay 16, 2024
- (Devlog 8) Player Animation and Headlamp OverhaulMay 06, 2024
- (Devlog 5) Ghost Prefabs and SpawnerApr 30, 2024
- (Devlog 6) Lighting and Post ProcessingApr 30, 2024
- (Devlog 4) Interactive Environment AssetsApr 28, 2024
- (Devlog 3) User Interface and ScenesApr 25, 2024
- (Devlog 2) Background GraphicsApr 24, 2024
- (Devlog 1) Player MovementApr 24, 2024
Leave a comment
Log in with itch.io to leave a comment.