WHAT'S NEW?
Loading...

Ular Tangga As3

Ular Tangga Kuis
Ular Tangga Kuis


Cuplikan script


addChild(tumb),tbr.visible = false;
for (i = 0; i < 100; i++)
{
 Kotak = new kotak(),cellWidth = Kotak.width + 2.5,cellHeight = Kotak.height + 3,cellX = i % 10,cellY = Math.floor(i / 10),Kotak.y = topMargin + (9 - cellY) * cellHeight,cellY%2 ? Kotak.x = (2*leftMargin) + cellX * (-cellWidth)+200-9:Kotak.x = leftMargin + cellX * cellWidth,Kotak.name = "kotak" + i,Kotak.id = i,tumb.addChild(Kotak),Ktk.push(Kotak),Kotak.nomor.text = i + 1,Kotak.mouseChildren = false;
}
tumb.addChild(ST),tumb.addChild(pt),tumb.addChild(pl),ST.x = Ktk[0].x + 10,ST.y = -10,pl.x = pt.x = Ktk[0].x - 10,pl.y=pt.y = Ktk[0].y+(Ktk[0].height/2);
ulartangga = function():void {pt.addEventListener(Event.ENTER_FRAME,EnterFrame);};
ulartanggalawan = function():void {pl.addEventListener(Event.ENTER_FRAME,EnterFramelawan);};
jalan = function():void {pt.gotoAndStop(2),ubah(),ulartangga();};
ubah = function():void {pemtemp +=  dd,pemtemp > 100 ? pemtemp = 100:pemtemp,jl=Ktk[pemtemp-1].x+ (Ktk[pemtemp-1].width/2),jlm=Ktk[pemtemp-1].y+ (Ktk[pemtemp-1].height/2);};
ubahlawan = function():void {musuhtemp +=  tt,musuhtemp > 100 ? musuhtemp = 100:musuhtemp,jllw=Ktk[musuhtemp-1].x+ (Ktk[musuhtemp-1].width/2),jlmlw=Ktk[musuhtemp-1].y+ (Ktk[musuhtemp-1].height/2);};
EnterFrame = function(e:Event=null):void {kirikanan(pt);};
EnterFramelawan = function(e:Event=null):void {kirikananlawan(pl);};
bataskanan = function (oj){oj.x = (421.2 + 30.5),oj.y = jlm,userkiri();};
userkiri = function (){kanan = false,kiri = true ,pt.scaleX =-1;};
userkanan = function (){kanan = true,kiri = false,pt.scaleX =1;};
bataskanan_lawan = function (oj){oj.x = (421.2 + 30.5),oj.y = jlmlw,arahkirimsh();};
bataskiri = function (oj){oj.x = 115.2,oj.y = jlm,userkanan();};
bataskirilawan = function (oj){oj.x = 115.2,oj.y = jlmlw,arahkananmsh();};
arahkananmsh = function (){kanan_lawan = true,kiri_lawan = false,pl.scaleX =1;};
arahkirimsh = function (){kanan_lawan = false,kiri_lawan = true,pl.scaleX =-1;};
kirikanan = function (oj){kanan ? _kanan(oj):_kiri(oj);};
kirikananlawan = function(oj){kanan_lawan ? _kananlawan(oj):_kirilawan(oj);};
_kanan = function (oj){oj.x +=  velocity,oj.y == jlm ?(oj.x > jl ?jalankanan(oj):(oj.x)):(oj.x > (421.2+30.5) ? bataskanan(oj):(oj.x));};
_kananlawan = function (ojl){ojl.x +=  velocity,ojl.y == jlmlw ?(ojl.x > jllw ?jalankanan_lawan(ojl):(ojl.x)):(ojl.x > (421.2+30.5) ? bataskanan_lawan(ojl):(ojl.x));};
_kiri = function(oj){oj.x -=  velocity;oj.y == jlm ? (oj.x < jl ? jalankiri(oj):oj.x):(oj.x < (115.2) ? bataskiri(oj):oj.x);};
_kirilawan = function (ojl){ojl.x -=  velocity,ojl.y == jlmlw ? (ojl.x < jllw ? jalankiri_lawan(ojl):ojl.x):(ojl.x < (115.2) ? bataskirilawan(ojl):ojl.x);};
jalankanan_lawan = function (oj){pl.removeEventListener(Event.ENTER_FRAME,EnterFramelawan),oj.x = jllw,oj.y = jlmlw,giliran_tampil.text = "Pemain1",tbr.visible = false,dadu_btn.gotoAndStop(1),tanggamusuh(pl,arahkirimsh,arahkananmsh);};
jalankiri_lawan = function (oj){pl.removeEventListener(Event.ENTER_FRAME,EnterFramelawan),oj.x = jllw,oj.y = jlmlw,giliran_tampil.text = "Pemain1",tbr.visible = false,dadu_btn.gotoAndStop(1),tanggamusuh(pl,arahkirimsh,arahkananmsh);};
jalankanan = function (oj){oj.x = jl,giliran_tampil.text == "Pemain1" ? giliran_tampil.text = "Komputer":giliran_tampil.text = "Pemain1",pt.removeEventListener(Event.ENTER_FRAME,EnterFrame),tbr.visible = true,dadu_btn.gotoAndStop(1),pl.gotoAndStop(2),acakndiri(),ubahlawan(),ulartanggalawan(),tanggauser(pt,userkiri,userkanan);};
jalankiri = function (oj){oj.x = jl,giliran_tampil.text == "Pemain1" ? giliran_tampil.text = "Komputer":giliran_tampil.text = "Pemain1",pt.removeEventListener(Event.ENTER_FRAME,EnterFrame),dadu_btn.gotoAndStop(1),pl.gotoAndStop(2),acakndiri(),ubahlawan(),ulartanggalawan(),tbr.visible = true,tanggauser(pt,userkiri,userkanan);};
dadu_btn.addEventListener(MouseEvent.CLICK,acak),dadu_btn.buttonMode = true;
function acak(event:MouseEvent=null):void
{
 tbr.visible = true,giliran_tampil.text = giliran,dadu_btn.gotoAndStop(1),ac=new randomm(mc_arr),dd = ac.randoman,dadu_btn.gotoAndStop(dd+1),jalan();
}
acakndiri = function (event:MouseEvent=null):void{dadu_btn.gotoAndStop(1),tc=new randomm(mc_arr),tt = tc.randoman,dadu_btn.gotoAndStop(tt+1);};
giliran_tampil.text = giliran;
tanggamusuh = function (o,akir,akan){pl.gotoAndStop(1),tang = new ularTangga(musuhtemp),musuhtemp = tang.ganti,tang.Arah == "kiri" ? akir():akan(),pl.x=Ktk[musuhtemp-1].x+(Ktk[musuhtemp-1].width/2),pl.y=Ktk[musuhtemp-1].y+(Ktk[musuhtemp-1].height/2),jlmlw = pl.y,tang.selesai == "finish" ? finishenemy():null;};
tanggauser = function (o,akir,akan){pt.gotoAndStop(1),tangus = new ularTangga(pemtemp),pemtemp = tangus.ganti,tangus.Arah == "kiri" ? akir():akan(),pt.x=Ktk[pemtemp-1].x+(Ktk[pemtemp-1].width/2),pt.y=Ktk[pemtemp-1].y+(Ktk[pemtemp-1].height/2),jlm = pt.y,tangus.selesai == "finish" ? finishuser():null;};
finishuser = function (){! null ? pt.removeEventListener(Event.ENTER_FRAME,EnterFrame):trace("kosong"),! null ? pl.removeEventListener(Event.ENTER_FRAME,EnterFramelawan):trace("kosong"),removeChild(tumb),gotoAndStop(3);};
finishenemy = function (){! null ? pt.removeEventListener(Event.ENTER_FRAME,EnterFrame):trace("kosong"),! null ? pl.removeEventListener(Event.ENTER_FRAME,EnterFramelawan):trace("kosong"),removeChild(tumb),gotoAndStop(4);};
stop();
function CloseApp(e:MouseEvent)
{
 fscommand("quit");
}


By Ricko nada di Pustaka Flash terima kasih telah membaca :) Ular Tangga Kuis ActionScript3

6 comments: Leave Your Comments

  1. Silakan dipahami dan di mengerti Semoga membantu :)

    ReplyDelete
  2. bagus bgt..... bisa order game ular tangga ny nggak??
    bwt TA.....

    ReplyDelete
    Replies
    1. boleh ja.... hubungi :call via email ja,.... nadaricko@yahoo.com

      Delete
  3. mas ini pae flash MX atau adobe flash CS??
    bisa di oerinci tidak cara pembuatannya

    ReplyDelete