top of page
Writer's pictureali mohamed

Don't Be Such A Boolean

Hello! Today we are going to work on making sure that the player actually has the packages. With how the game is now, the player can deliver the package even though they didn't get it. So today, through the use of booleans, we are going to fix that issue. It's time to put our boolean wizardry to work and address this issue head-on.





In Unity, booleans are a powerful tool that allows us to create true/false conditions within our game logic. With their help, we can implement a system that verifies if the player has successfully acquired the packages before making a delivery. To begin, we'll integrate a boolean variable into our player script. Let's call it "hasPackages." By default, this boolean will be set to false, indicating that the player hasn't picked up any packages yet. Next, we'll establish a trigger collider around the packages. When the player character enters this trigger, we'll update the "hasPackages" variable to true, indicating that the packages have been acquired. This way, the player will need to physically interact with the packages to progress in the game.





Now, when it comes to delivering the packages, we'll implement a check that examines the value of "hasPackages." If it's true, the player will be able to complete the delivery. However, if it remains false, they will be prompted to return to the packages and pick them up before proceeding.

By utilizing booleans effectively, we ensure that the gameplay mechanics align with the player's actions, enhancing the overall immersion and realism of the experience. With this implementation, players will need to take responsibility for securing the packages, delivering a more engaging and satisfying gameplay loop.



So, let's roll up our sleeves, dive into Unity's scripting capabilities, and create a seamless and believable pizza delivery adventure, where success hinges on the player's diligent completion of their tasks. Stay tuned for more updates as we continue our game development journey!

10 views0 comments

Recent Posts

See All

Comments


bottom of page