Showing posts with label Interactivity. Show all posts
Showing posts with label Interactivity. Show all posts

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.

 
 
 


Interactivity - Customization


the first customization i made was making the background scroll i.e a moving background. I did this by making a new script called offset scroller.
 
 

To attach the script to the already made background and then changed the speed to 0.1 giving a smooth scroll in the background.

I then took the background in to Photoshop and took a few spaces images from the internet and blended the layers together to get that purple colored background.

using an EastEnders character making the game more fun and interesting.


Tuesday, 10 March 2015

Interactivity 5th session

We started this session off with creating a new script to destroy our object.

 Script looking as follows
 

 

However, since the OnTriggerEnter is checking for all collisions, the asteroid dissapears instantly. To fix this the script was adapted to the following

 
 

when the asteroids come in contact with bolts upon fire we created a explosion effect In to the script the script now looking as follows

 


 



The next step was adding a boundary box to the game so that the asteroid would spawn in off screen.


 The script looking as follows
 



to get our asteroids to spawn multiple times on a continues loop we added to do the script



 

Wednesday, 4 March 2015

Interactivity 6th session


To start off we created a script to destroy our explosion prefabs after they've been exploded.

 

Next it's was time to add some audio to our game. This is done with an audio source component through the inspector panel

 

 
Also we added some background music to the GameControlergameobject.

and alsoaddedsome score text. We did this using a GUIText component on an empty gameObject.

 We then set up our scoring values through the game controller script by adding in modifications. The script now looking as follows with added modification.
 
 

now the game is finished it is now time for the exciting part and customizing the game.

 

 

Thursday, 12 February 2015

Interactivity - Ship Rotation and Shooting

In our 4th session we started with a refresher exercise of C# coding. We were asked to create a script with a variable that counts up every time a Boolean is true, and when the variable reaches 5 a force is added to the cube's rigid body component. The final script looked like this below:







Having spent about half hour doing this short refresher we continued with our game project.


We added a new line code to the PlayerController script to stop the player ship from moving out of the game screen, with the new line added the script looked like this:







We then created a new set class and added four variables in to that. We then tweaked the code to find the variables.





After this we then started a new coding within the same script, to make the ship to rotate when it moves. to do this we created a tilt variable, and then linked it to the ship's rotation.







To make the ship rotate we used the following code:


 

After we finished making the ship move we created a quad, and added it to an empty game object that will store the code. Then we created a new material and added a texture to it.
To remove the black edge that appeared over the bolt component, we changed the shader to a Additive Particle getting rid of the black edge. We then added a rigidbody component to the "Bolt" empty gameobject to run the code.





Lastly to wrap the session up we added a cylindrical colider and shaped it to roughly fit the texture.







Monday, 9 February 2015

Interactivity: Further Game Development

In our 3rd session we started to add more elements to our game. We lit the scene using a three point lighting system, we explored materials and added a background plane to our game.

 

We then created a script to make our ship move based on the horizontal and vertical axis:

using UnityEngine;using System.Collections;
public class PlayerController : MonoBehaviour {
    public float moveHorizontal = 0;    public float moveVertical = 0;    public float speed = 10;
    public float xMin,xMax,zMin,zMax;
    public Vector3 movement = Vector3.zero;
    void FixedUpdate ()     {        moveHorizontal = Input.GetAxis ("Horizontal");        moveVertical = Input.GetAxis ("Vertical");
        movement = new Vector3 (moveHorizontal,0,moveVertical);
        transform.rigidbody.velocity = movement * speed;    }






The game spaceship from game view.  I feel exicted knowing that I made this and how this interactive software and learning it's attributes will come in handy someday.