Manual Book
Pembuatan Game Pesawat Tempur
Nama :
Andes Candra Gunawan
Kelas :
3IA12
NPM :
50412738
Universitas Gunadarma
2015
Langkah Pertamma pembuatan game ini adalah dengan membuat komponen yang
diperlukan seperti karakter, script dan partikel.











Setelah semua komponen
jadi, kita ketikan script yang diperlukan
Script Player
var projectile
:Transform;
var soketprojectile :Transform;
static var liveplayer :int =5;
var kecepatan : float = 10.0;
function Update () {
var kirikanan : float = Input.GetAxis
("Horizontal") * kecepatan;
var majumundur : float = Input.GetAxis
("Vertical") * kecepatan;
kirikanan *=Time.deltaTime;
majumundur *=Time.deltaTime;
transform.Translate ( kirikanan,0,0);
transform.Translate ( 0,majumundur,0);
transform.position.x=Mathf.Clamp(transform.position.x,-11,11);
transform.position.y=Mathf.Clamp(transform.position.y,-8,8);
if (Input.GetButtonDown("Jump"))
{
Instantiate(projectile,soketprojectile.position,soketprojectile.rotation);
}
if (liveplayer<=0)
{
Application.LoadLevel("Kalah");
}
}
function OnTriggerEnter
(other :Collider)
{
if (other.
gameObject.tag=="Enemy")
{
nyawaplayer();
}
}
function nyawaplayer()
{
liveplayer-=1;
}
function OnGUI()
{
GUI.Label(Rect(250,30,100,20),"NYAWA
:" + liveplayer);
}
Script Musuh
var kecepatanasteroid:
float = 6.0;
var ledakan :Transform ;
static var score :int =0;
var gamelimit :float =60;
InvokeRepeating("CountDown",1.0,1.0);
function Update () {
transform.Translate(Vector3.down*kecepatanasteroid*Time.deltaTime);
if (transform.position.y<=-12)
{
transform.position.y=12;
transform.position.x=Random.Range(-11.0,11.0);
}
if (gamelimit <=0)
Application.LoadLevel("win");
}
function OnTriggerEnter
(other :Collider)
{
if (other.
gameObject.tag=="Peluru")
{
tambahscore();
}
if (other.
gameObject.tag=="Player")
{
if (ledakan)
{
Instantiate(ledakan,transform.position,transform.rotation);
}
transform.position.y=13;
transform.position.x=Random.Range(-11.0,11.0);
}
}
function tambahscore()
{
score+=1;
}
function OnGUI()
{
GUI.Label(Rect(150,30,100,35),"SCORE :" +
score);
GUI.Label(Rect(350,30,100,35),"WAKTU :" +
gamelimit);
}
function CountDown()
{
if (-- gamelimit==0)
{
CancelInvoke ("Countdown");
}
}
Kemudian Build aplikasi


Tidak ada komentar:
Posting Komentar