Unfortunately this weekend I ended up with a cold (not Covid) so have been still a little groggy today, but I still did my best to push through my daily challenges of being able to critically think through my next steps in what is needed next for my space shooter 2D game to progress.
In the same fashion as my previous days, today is no exception to the growth and development GameDevHQ’s courses are forcing me to do each and every day.
Today’s challenge was figuring out what to use to add scenes and recall/restart them (my challenge was to find what was needed to have an input for the R-key, at the end of the game, and then have the game restart).
This was not an easy thing to learn from my own research, but being that I’ve been training in this for 11 days now, I had some ideas of how this might come about. To which, through my searching of how to add a scene, and for a scene to be used properly, I needed to use UnityEngine’s SceneManagement to the library of a new script.
I also learned that I must add the scene to the build settings, but was not entirely sure of how to go about running it from there. I knew I would use the (Input.GetKeyDown(KeyCode.R) to then use it to load the game over again (the scene), but I failed to check against if the game was over at the same time (using &&). I also was unsure of where to check it against, so whether to use it when player lives reached 0 in the Player.cs, or in UIManager.cs under GameOverSequence (which now after going through the challenge review, makes a lot more sense than using it with player lives).
Though there are times that in the challenge review I am able to get the codes working well, they are not always the way that Jon shows us how he would do it. But I’m always proud of myself when I put the effort in to figure it out on my own, and even prouder when I am able to execute the logic sequences necessary for when what I want to happen is achieved.
But what is most important in my failings/winnings in these challenges to grow, is that I learn from it and that I never give up.
[Is it weird that just now, looking at my screenshot, I realized why Jon had us set the “Score “ + 0 before we had even gotten to the restart section of this? So that every new game “0” would be there…lol the synapses are working]