Road Trip Breakdown Dev Log 4/25/17
Hello everyone! We did some major updates on the project that I’m excited to share! We added high scores, an instructions scene, multiplayer, and switched from using cursor to keyboard inputs. We now have a car selection screen as well.
I added a selector to the game so it doesn’t use the cursor anymore it uses keyboard inputs. It’s a little “sticky” currently but it is able to match and has state conveyance for when an item is clicked on and switched.
I will go into more detail here. This was a little tricky because we wanted to keep the wheels separate from the car so another member could animate them moving.
I started out with saving the index in PlayerPrefs and then creating an array to hold all the cars and its child objects.
index = PlayerPrefs.GetInt("CharacterSelected");
characterList = new GameObject[transform.childCount];
Then made a for loop so all the child objects are entered into the array.
for(int i = 0; i < transform.childCount; i++)
{
characterList[i] = transform.GetChild(i).gameObject;
}
Once its in the array you can do an if statement to toggle on characters as they are selected. Then I created two methods for when the “Back” and “Next” buttons were used. Incrementing and decrementing through the array to find the cars.
For the Car Selection screen I had some trouble with getting the child objects of the car to display on the screen. After trying several things I figured out that the character list had to be put as one of the top items in the canvas. Simple fix but took a while to figure out. Now know in the future.
The prototype is currently up on itch.io check it out!
Will keep you posted! :) Good night!