Game fully working!
The full game is done with the Main Menu, Minigame 1 and Minigame 2.
I added small new things
Minigame 1:
- Tutorial Page at the start fully works, including displaying the layout of the breadboard and the testing part works too. Here, the P1ZPos variable (the variable that stores the reading of the potentiometers and turns the range of 0->1023 into -6->6) has maths done on it to fit it onto the range of the screen. Each potentiometer controls a car icon, and the car has to be on the very right (aka potentiometer to the max), on top of it’s green silhouette. Both cars need to remain there for 5s for game to start.
Minigame 2: - camera elevates each block so it doesn’t go off screen
- also tutorial page now works with the test, where both players have to hold onto their button for 5 seconds before starting. there was an issue i had to fix for these buttons, figuring out a way to only send one reading when the player holds it down to click once, because readings are sent really frequently, a hold for less than a second led to 20 occasions of button being held down, so I added another variable, buttonPressedOnce, did some logic operations with buttonHeld (the readings) to make sure the signal is sent once. (side note, I know realise I should have done devlogs more frequently because i could’ve gone into more detail explaining the things I’ve learnt, but alas, I tried to explain as much as I could in my actual code, for anyone checking it out)
Here’s the new major stuff!
The Main Menu came with a lot of challenges. The idea was for the user to use a potentiometer and a button to scroll between games and select. Issue was, multiple instances of Arduino Connector happened, with scenes being reloaded and led to all kinds of chaos. So I had to do some Instancing, removed Arduino Connector from Minigame Scenes. I also had to add a score manager, that also would be permanent and instanced, so variables could stay the whole time the game was run. Also, to connect the winners of the minigame to the score manager, I had to include win conditions to each of the minigame game handler scripts. Then the Score manager would read from the public variable “winner” in those Game Handler scripts, to see who won and increment the respective score.
Then, I realised a small flaw. The Arduino Connector script was static to the usual port that I used on my computer, but a different user would be using a different port. So, I added a textbox and a porthandler to recieve info from that textbox into a public variable for the Arduino Connector script to retrieve and refresh the port entered, to ensure connection still works if changed.
That was it, the game functions perfectly fine, however there is one major thing I have to do before shipping. I had to showcase this prototype of a game to a summer program I was doing, and realised that when I was showcasing, everything was already setup for people to use. But I was only able to setup the game since I knew the way. I never showed a setup schematic in the main menu, nor did I even give the user the Arduino IDE code to send to their board. These crucial extra details I will do in future devlogs, but so far, that was my game!