»
EnglishFrenchVietnamese

Print - Fireman - JavaScriptBank.com

Full version: jsB@nk » Game » Skill » Fireman
URL: https://www.javascriptbank.com/fireman-index.html

Fireman © JavaScriptBank.comThere are fires everywhere in the 6 storey building and you're the only trust-worthy fireman.

Full version: jsB@nk » Game » Skill » Fireman
URL: https://www.javascriptbank.com/fireman-index.html



HTML
<script src=laydiv.js></script><body onload="Init()"><script>GetDiv("Plan",20,130,450,470,'',1,1)document.write("<img src=plan.gif height=470 width=450><p><hr><p>")document.write("<b>Fireman - JavaScript Game - Press key 'h' for hints.<P>")EndDiv()n=0for(fl=0;fl<6;fl++){for(rm=0;rm<10;rm+=2){GetDiv("Fire"+n,fl*80,250+rm*20,60,40,'',0,1)document.write("<img src=fire.gif width=60>")EndDiv()n++GetDiv("Fire"+n,40+fl*80,285+rm*20,60,40,'',0,1)document.write("<img src=fire.gif width=60>")EndDiv()n++}}GetDiv("You",100,285,60,40,'',1,3)document.write("<img src=man0.gif width=60>")EndDiv()GetDiv("You2",100,285,60,40,'',0,3)document.write("<img src=man1.gif width=60>")EndDiv()GetDiv("Lift",20,185,60,40,'',1,2)document.write("<img src=lift.gif width=60>")EndDiv()HelpLine="Fireman Game by Kien Caoxuan\n_________________________________\n\n"HelpLine+="\nThere are fires on the floor of this building."HelpLine+="\nYou're the only fireman around."HelpLine+="\nGo and extinguish the fires!"HelpLine+="\nUse the weird lift, which must go all the way"HelpLine+="\ndown before it can go up!"HelpLine+="\nUse the numeric keypad (on the right side of the keyboard)"HelpLine+="\n2-down 4-left 6-right 8-up."HelpLine+="\nStep on the lift to make it go.\nStamp on the fire to extinguish it"HelpLine+="\nYou lose if there are more than 8 fires...\n\nGood luck!"if(document.layers)document.captureEvents(Event.KEYPRESS);document.onkeypress=GetKeytheKey=0function GetKey(evt){if(GameOver==1)returnif(N||S)theKey=evt.whichif(M)theKey=window.event.keyCodeMoveIt()}function MoveIt(){ShowHide("You2",0)ShowHide("You",1)Dx=0Dy=0if(OnLift==1&&LStop==0)returnOnLift=0clearTimeout(LiftLoop)if(theKey==104)alert(HelpLine)if(theKey==52)Dx=-40if(theKey==54)Dx=40if(theKey==50)Dy=20if(theKey==56)Dy=-20Cx=Xof("You")+Dxif(Cx>500||Cx<150)returnCy=Yof("You")+Dyif(Cy<TheFloor*80||Cy>TheFloor*80+40)returnPutIt("You",Cx,Cy)if(Cx==Xof("Lift")&&Cy==Yof("Lift")){OnLift=1Lift()}for(chk=0;chk<10;chk++){if(Cy==Yof("Fire"+parseInt(TheFloor*10+chk))){if(Cx-20==Xof("Fire"+parseInt(TheFloor*10+chk))||Cx-15==Xof("Fire"+parseInt(TheFloor*10+chk))){if(VisOf("Fire"+parseInt(TheFloor*10+chk))==1){Score++window.status=ScoreShowHide("Fire"+parseInt(TheFloor*10+chk),0)PutIt("You2",Xof("You"),Yof("You"))ShowHide("You2",1)ShowHide("You",0)}}}}}function Init(){for(fir=0;fir<60;fir++){ShowHide("Fire"+fir,0)}GameOver=0FireNum=0Score=0OnLift=1Fl=0Lift()Game=setInterval('Fire()',3000)}function Fire(){if(GameOver==1)returnFireNum++if(FireNum-Score>10)Lose()ranF=Math.floor(Math.random()*60)ShowHide("Fire"+ranF,1)window.status="Use keys 2,4,6,8 in the numeric keypad to move about."}function Lift(){if(Fl<1)Dir=1if(Fl>79)Dir=-1Fl+=DirPutIt("Lift",185,20+Fl*5)if(OnLift==1)PutIt("You",185,20+Fl*5)if(Fl%16==0){LStop=1Delay=500TheFloor=Fl/16window.status="You are on floor "+(6-TheFloor)}else {LStop=0Delay=100}LiftLoop=setTimeout('Lift()',Delay)}function Lose(){GameOver=1clearInterval(Game)alert("Game over!\nScore :"+Score)if(confirm("Play again?"))Init()}</script></body><!--    This script downloaded from www.JavaScriptBank.com    Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->


Files
http://javascriptbank.com/javascript/game/Fireman/laydiv.jshttp://javascriptbank.com/javascript/game/Fireman/fire.gifhttp://javascriptbank.com/javascript/game/Fireman/lift.gifhttp://javascriptbank.com/javascript/game/Fireman/man0.gifhttp://javascriptbank.com/javascript/game/Fireman/man1.gifhttp://javascriptbank.com/javascript/game/Fireman/plan.gif