Sunday, March 9, 2014

game description

//Learning Objective:
// -File and Assets managment
// -Basic game scripting
// -GUI element
// -Input
// -Events
// -Scene Loading


//Game Concept:
// Space shooter where player must avoid astroids from detryoing their ship
//  as they try to score as many point as they can by shooting the astroid in a given amount of time

//Control:
// Arrow keys to move (4 directions: up, down, left, right)
// spacebar to shoot
// e to creates a temporary shield

// Assets:
// - Player
// - Astroid
// - Bullet
// - Shield
//  - Blocker
//  - Explosion

Asset list


Credit Screen

// Credit Screen

// Inspector Variables

//

function OnGUI ()
{
// Make a group @ center of screen
GUI.BeginGroup(Rect (Screen.width/2-100,Screen.height/2-100,200,200));

// make box to see the group on screen
GUI.Box(Rect(0,0,200,200),"Credit");

//Credit
GUI.Label(Rect(10,40,210,50),     "By :  Kulprawee Prayoonsuk");
GUI.Label(Rect(10,70,200,80),     "Tutorial by WalkerBoyStudio ");
GUI.Label(Rect(10,100,200,110),   "Special Thank to  Alex Caswell");
GUI.Label(Rect(10,130,200,140),   "Mentor : Mr. Dan Cornell");
// Add BUttons here
if (GUI.Button(Rect(60,165,80,30),"Back"))
{
Application.LoadLevel("ScreenMainMenu");
}


// End group
GUI.EndGroup();
}

Lose Screen Script

// Lose Screen Script

// Inspector *Script attach to main camera
var loseQuote : String = "You Lose";

//
function OnGUI ()
{
// Make a group @ center of screen
GUI.BeginGroup(Rect (Screen.width/2-100,Screen.height/2-100,200,200));

// make box to see the group on screen
GUI.Box(Rect(0,0,200,100),loseQuote);

//Scores
GUI.Label(Rect(10,30,100,50),"Score:"+PlayerPrefs.GetInt("SCORE"));

//Back to main button
if(GUI.Button(Rect(60,60,80,30), "Main Menu"))
{
Application.LoadLevel("ScreenMainMenu");
}


// End group
GUI.EndGroup();
}

Win Screen Script

// Win Screen Script

// Inspector *Script attach to main camera
var winQuote : String = "You WIN!";

//
function OnGUI ()
{
// Make a group @ center of screen
GUI.BeginGroup(Rect (Screen.width/2-100,Screen.height/2-100,200,200));

// make box to see the group on screen
GUI.Box(Rect(0,0,200,100),winQuote);

//Scores
GUI.Label(Rect(10,30,100,50),"Score:"+PlayerPrefs.GetInt("SCORE"));
//Back to main button
if(GUI.Button(Rect(60,60,80,30), "Main Menu"))
{
Application.LoadLevel("ScreenMainMenu");
}


// End group
GUI.EndGroup();
}

Load Screen Script

// Load Screen Script

// Inspector Variables
var waitTime : float = 3.0;

//
function Update ()
{
if(Input.GetKeyDown("space"))
{
Application.LoadLevel("Level1");
}
else
{
Waittime();
}
}

function OnGUI ()
{
// Make a group @ center of screen
GUI.BeginGroup(Rect (Screen.width/2-100,Screen.height/2-100,200,200));

// make box to see the group on screen
GUI.Box(Rect(0,0,200,200),"Instructions");

//Instructions for player
GUI.Label(Rect(10,30,140,40),"Arrow Keys to Move");
GUI.Label(Rect(10,60,160,70),"Spacebar to Shoot");
GUI.Label(Rect(10,90,180,100),"E to create a temporary shield");
GUI.Label(Rect(10,120,200,100),"Esc to Quit the Game");

GUI.EndGroup();
}

function Waittime()
{
yield WaitForSeconds(waitTime);
Application.LoadLevel("Level1");
}

Main Menu Script

// Main Menu Script

// Inspector Variables

function OnGUI ()
{
// Make a group @ center of screen
GUI.BeginGroup(Rect (Screen.width/2-50,Screen.height/2-50,100,175));

//Make a box to see group on screen
GUI.Box(Rect(0,0,100,175),"Main Menu");

//Add buttons for game navigation
if (GUI.Button(Rect(10,30,80,30),"Start Game"))
{
Application.LoadLevel("ScreenLoad");
}
if (GUI.Button(Rect(10,65,80,30),"Credits"))
{
Application.LoadLevel("ScreenCredit");
}
if (GUI.Button(Rect(10,100,80,30),"Exit"))
{
Application.Quit();
}
if (GUI.Button(Rect(10,135,85,30),"Project Blog"))
{
Application.OpenURL("http://celosiaproject.blogspot.com/");
}

GUI.EndGroup();
}