Sabtu, 25 April 2009

TUTORIAL GAME SEDERHANA DI M. FLASH

TUTORIAL GAME SEDERHANA DI M. FLASH

1. Buka program aplikasi M. flash yang tentunya sudah diinstal.
2. Lalu pilih flash document.
3. Buatlah background layer sesuai selera Anda.
4. Lalu buatlah bentuk persegi panjang sebagai salah satu item untuk game kita, convert ke movie clip.
5. Dan buatlah bolanya, convert ke movie clip.
6. Lalu pada frame 1 berikan action script:

_root.val = 5;
_root.valy = 5;
_root.score = 0;

7. Lalu pada frame 2, beri action script:

i++;
speed = 9;
_root.fric._visible = 0;
_root.fric.duplicateMovieClip("fric" + i, i);
_root["fric" + i]._x = _root.bal._x;
_root["fric" + i]._y = _root.bal._y;

8. Lalu pada frame 3, beri action script:

gotoAndPlay(2);

9. Lalu pada frame 4:

pncom.storeScore(_root.score);
Mouse.show();

10. Lalu pada gambar bola yang tadi kita buat, beri action script:

onClipEvent (enterFrame)
{
setProperty(_root.bal, _x, getProperty(this, _x) + _root.val);
setProperty(_root.bal, _y, getProperty(this, _y) + _root.valy);
}
onClipEvent (enterFrame)
{
if (this.hitTest(_root.bal))
{
_root.val = -random(15);
} // end if
}

onClipEvent (enterFrame)
{
if (this.hitTest(_root.bal))
{
_root.val = random(15);
} // end if
}

onClipEvent (load)
{
startDrag("", true, 265, 330, 435, 330);
Mouse.hide();
}

onClipEvent (enterFrame)
{
if (this.hitTest(_root.bal))
{
_root.valy = -15;
_root.score = _root.score + 1;
tellTarget(_root.bal)
{
play();
} // End of TellTarget
} // end if
}

onClipEvent (enterFrame)
{
if (this.hitTest(_root.bal))
{
removeMovieClip(_root.bal);
gotoAndPlay(4);
} // end if
}

onClipEvent (enterFrame)
{
if (this.hitTest(_root.bal))
{
_root.valy = 15;
} // end if
}



Bagi yang pengen download contoh gamenya, klik http://www.4shared.com/file/101440711/60ab4c63/reza_muntaha_x-tkj1_tugas_game_flash.html

Sekian…

Tidak ada komentar:

Posting Komentar