kode nyamuk buat flash


//kondisi awal
onClipEvent(load) {
moveX=0;
moveY=0;
nyamukMati=0;
}
onClipEvent(enterFrame) {
//menentukan pergerakan acak pada nyamuk
acakMoveX=Math.floor(Math.random()*10);
acakMoveY=Math.floor(Math.random()*10);
if(nyamukMati==0)
{
if(acakMoveX<2) {
moveX =20;
}
else if(acakMoveX>6) {
moveX =-20;
}
if(acakMoveY<2) {
moveY =20;
}
else if(acakMoveY>6) {
moveY =-20;
}

if(this._y>600)
{
this._y=0;
}
else if(this._y<0)
{
this._y=600;
}
else if(this._x<0)
{
this._x=800;
}
else if(this._x>800)
{
this._x=0;
}
}
else
{
moveX=0;
moveY=0;
}
this._x +=moveX;
this._y +=moveY;

//menghapus movieclip nyamuk yang mati
if(this._currentframe==10)
{
removeMovieClip(this);
}
}

//kondisi saat nyamuk terpukul raket
onClipEvent(mouseDown)
{
if(this.hitTest(_root.raket.area)&&this._currentframe==1)
{
this.play();
nyamukMati=1;
}
}

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s