Phiên bản đầy đủ: jsB@nk » Trò chơi » Bắn súng » Bắn ong
URL: https://www.javascriptbank.com/swatfly.html
Một trò chơi JavaScript bắn ong dạng đơn giản khác mà không sử dụng hình ảnh.
Phiên bản đầy đủ: jsB@nk » Trò chơi » Bắn súng » Bắn ong
URL: https://www.javascriptbank.com/swatfly.html
<SCRIPT language=JavaScript><!--var timerID = nullvar patno=1var cr="\r\n" //for windowsvar blankno=0var totalblank=""var lr=1 //if lr=-1 then left , lr=1 then rightvar lowerlf="" //lower side spacevar downlf="" //upper side spacevar downno=0var inplay=0var missilex=99 //missile positionvar missiley=99var mychrx=1 //my charactor positionvar myblank=""var mymove=0var spcf1=""var spcf2=""var spcf3=""var hitflag=0var score=0var selec=0 //machine selectvar mname=" Windows is"var rsmiss="" //missile no hit R sidefunction array1(arn) { //Here Kitty Kittythis.length = arn;for (var ar1 = 0; ar1 <= arn; ar1++) {this[ar1] = 1 }return this}function onloadmes(){document.fmark.win.value=" "cr = unescape("%0A")ver=navigator.appVersionlen=ver.lengthfor(iln=0;iln<len;iln++) if(ver.charAt(iln)=="(") breaksystm = ver.charAt(iln+1).toUpperCase()if(systm=="M"){cr = unescape("%0D")}if(systm=="W"){cr = unescape("%0D")+cr}if(systm=="C"){cr = unescape("%0D")+crtmpsys = ver.charAt(0).toUpperCase()if (tmpsys == 4){cr = unescape("%0D")}}// document.fmark.win.value=verstarter()}function initThis(){ //syokikablankx = new array1(63) //Dim blankx(63)for (var makeblank = 0;makeblank < 63;makeblank++){blankx[makeblank]=""for (var addBlank = 0; addBlank < makeblank; addBlank++) {blankx[makeblank] = blankx[makeblank] + " "}}faker = new array1(24); //faker(1) to (24) = facemark active flagface = new array1(2); //Dim face(2)face[1]=" :) "face[2]=" :P " mestotal =new array1(4) //Dim mestotal(4)interval1()}function restarter(){inplay=0blankno=0totalblank=""lr=1lowerlf=""downlf=""downno=0missilex=99missiley=99mychrx=1myblank=""mymove=0selec=1starter()}function starter(){document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+" Phazers locked on; let's blast some aliens!!"+cr+cr+cr+" Click FIRE to begin!"selec=1}function goleft(){mymove=0mychrx=mychrx-1if (mychrx <= 0){mychrx=1}}function goright(){mymove=0mychrx=mychrx+1if (mychrx >= 56){mychrx=55}}function golmax(){if (inplay == 1){mymove=-1}}function gormax(){if (inplay == 1){mymove=1}}function fire(){if (inplay == 0){if (selec == 1){selec=9inplay=1initThis()}}else{if (missiley == 99){missiley=18missilex=mychrx+3}}}function gameover(){ //GAME OVERscore=0for (var enerme=1;enerme<25;enerme++){if (faker[enerme] == 1){score=score+1}}if (score == 0){document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr+" Congratulations!"+cr+cr+" THE EARTH IS SAVED!!!"}else{document.fmark.win.value=cr+cr+cr+cr+cr+cr+cr+cr+" GAME OVER"+cr+cr+" "+score+" MARTIANS NOW RULE THE EARTH!!"}inplay=0}function interval1(){ //ferrets r gross 1if (missiley != 99) {missiley=missiley-1}if (missiley < 0){missiley=99}mychrx=mychrx+mymoveif (mychrx <= 0){mychrx=1}if (mychrx >= 56){mychrx=55}blankno=blankno+lr //offset count uptotalblank = blankx[blankno] //offset Dead Fishyif (blankno >= 20) {lr=-1downno=downno+1blankno=20}if (blankno <= 0) {lr=1downno=downno+1blankno=0}if (downno >= 12) {gameover()}//upper side ariadownlf=""for (var upperspc=0;upperspc<downno;upperspc++){if (missiley == upperspc){downlf=downlf+blankx[missilex]+"|"+cr}else{downlf=downlf+cr}}//facemark changeif (inplay == 1){patno=patno+1if (patno >= 3) {patno = 1}//face ariafor (var addline = 1; addline < 5; addline++){mestotal[addline]=totalblankrsmiss=""if (missiley == (downno+addline*2-2)){if (blankno <= missilex){hitflag=parseInt((missilex-blankno)/7,10)if (hitflag < 6){if ((missilex-blankno-(hitflag*7)) >= 1){if ((missilex-blankno-(hitflag*7)) <= 5){if (faker[(addline*6)+hitflag-5] == 1){faker[(addline*6)+hitflag-5] = 0missiley=99}}}}else{if (missilex > (blankno+42)){rsmiss=blankx[missilex-blankno-42]+"|"}}}else{mestotal[addline]=blankx[missilex]+"|"if (missilex < (blankno-1)){mestotal[addline]=mestotal[addline]+blankx[blankno-1-missilex]}}}for (var addfaker = 1; addfaker < 7; addfaker++){if (faker[(addline*6)+addfaker-6] == 1){mestotal[addline]=mestotal[addline]+face[patno]}else{mestotal[addline]=mestotal[addline]+" "}}mestotal[addline]=mestotal[addline]+rsmiss}//space line in face ariaspcf1=crspcf2=crspcf3=crif (missiley == (downno+1)){spcf1=blankx[missilex]+"|"+cr}if (missiley == (downno+3)){spcf2=blankx[missilex]+"|"+cr}if (missiley == (downno+5)){spcf3=blankx[missilex]+"|"+cr}//lower side arialowerlf=""for (var lowerspc=0;lowerspc<(11-downno);lowerspc++){if (missiley == (downno+7+lowerspc)){lowerlf=lowerlf+blankx[missilex]+"|"+cr}else{lowerlf=lowerlf+cr}}myblank=blankx[mychrx]document.fmark.win.value = downlf+mestotal[1]+cr+spcf1+mestotal[2]+cr+spcf2+mestotal[3]+cr+spcf3+mestotal[4]+cr+lowerlf+myblank+" A "+cr+myblank+" ! !"timerID = setTimeout("interval1()",250)}}//--></SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
<FORM name=fmark><CENTER><TEXTAREA name=win rows=20 cols=60></TEXTAREA> </CENTER><CENTER><PRE><INPUT onclick=golmax() type=button value=" "><INPUT onclick=goleft() type=button value=" LEFT "> <INPUT onclick=fire() type=button value=FIRE> <INPUT onclick=goright() type=button value=RIGHT><INPUT onclick=gormax() type=button value=" "></PRE></CENTER><BR><P><CENTER><PRE><INPUT onclick=restarter() type=button value=" START "></PRE><HR><INPUT onclick=window.close() type=button value=Close> </CENTER></FORM><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->