Friday, 20 March 2015

Interactivity - Further Customization


Adding a menu to create a menu i had to create a new scene. I created new scene > new game object the dragged the background on to the new game object. I then created a new script called menu and applied the script to the new game object. And also changed the background size and changed the xMin Xmax values so that asteroids and ship would pan across the whole screen.

 

script looking like this:
 
 

 

I then brought in the ship and dragged it on to the scene. Then i played with the camera to give a more close head view of the menu. the menu completed looking as follows-

 
Adding the Highscore this was the tricky bit which took quite a while to achieve. In the hierarchy panel i duplicated the score text and made a new script called highscore  the script looking like this
 
 
This was the tricky bit because when i attached the script to duplicated Guiscore text, when playing the game the score value would go up but the high score value would stay at 0. It took me while too figure this out.
So i had a further look and found the cause of the problem in the script where it says public gamecontroller above that i added a static int variable. Thus making the highscore work how this script works is everytime you play the game what ever score you get for example 25 and if die in the game the highscore works like that. So basically the highscore is implemented after every restart of the game.
 
and of course changed the music to the theme of Casaulty .
 
as you can see on the right hand side of the screen. Where it says Audio Source.
by going to inspector panel on the right side of the screen. Then Audio source the soundtrack being imported in after i downloaded it online.
Further customization i changed the asteroids size so that when spawning down different sized hazards would appear making the game more hard.
 
As you can the different sized hazards spawning i also changed some the asteroids colours these coloured asteroids are worth more points. how i went about doing this pretty simplistic.
 
in the assets folder in the prefabs > vfx folder where i stored the asteroids i duplicated the asteroids three times then dragged them in to scene view and resized them.
 

then in the inspector panel with blue asteroid picked in the panel in the destroy by contact script i changed the score to 5 so that this specific asteroid is worth more points. and then made minor tweaks in the destroy by contact script so that when you hit this coloured asteroid two times before claiming the points.
 
as you can see in inspector panel under the destroy by contact health script.

to change the color of the asteroid i clicked the asteroid in the bottom panel to where it displays a tiny arrow i clicked that to bring the second coloured asteroid up as you can see then in the inspector panel. Main color i changed the colour.

 
 
 


No comments:

Post a Comment