Full version: jsB@nk » Pointer » Trailer » Pacman
URL: https://www.javascriptbank.com/pacman-index.html
A simulator effect with Pacman game.
Full version: jsB@nk » Pointer » Trailer » Pacman
URL: https://www.javascriptbank.com/pacman-index.html
<SCRIPT LANGUAGE = "Javascript1.2" >ammount = 10;times = 1;wait = 0;done = false;x = new Array();y = new Array();temp = 0;waitUntil = 10;pillSrc = "Pill.gif";pacCESrc = "PacCE.gif";pacOESrc = "PacOE.gif";pacCWSrc = "PacCW.gif";pacOWSrc = "PacOW.gif";for (i = 1; i <= ammount; i++) document.write('<DIV ID = "pill' + i + '" STYLE = "visibility: hidden; position: absolute"><IMG NAME = "pic' + i + '" SRC = "' + pillSrc + '"></DIV>');pillW = document.pic1.width;pillH = document.pic1.height;document.write('<DIV ID = "pacCE" STYLE = "visibility: hidden; position: absolute"><IMG NAME = "pac1E" SRC = "' + pacCESrc + '"></DIV>');document.write('<DIV ID = "pacOE" STYLE = "visibility: hidden; position: absolute"><IMG NAME = "pac2E" SRC = "' + pacOESrc + '"></DIV>');document.write('<DIV ID = "pacCW" STYLE = "visibility: hidden; position: absolute"><IMG NAME = "pac1W" SRC = "' + pacCWSrc + '"></DIV>');document.write('<DIV ID = "pacOW" STYLE = "visibility: hidden; position: absolute"><IMG NAME = "pac2W" SRC = "' + pacOWSrc + '"></DIV>');showPacC = document.getElementById("pacCE").style;showPacO = document.getElementById("pacOE").style;pacCWidth = document.pac1E.width;pacCHeight = document.pac1E.height;pacOWidth = document.pac2E.width;pacOHeight = document.pac2E.height;function pacPicC(){ temp = place + 1; if (temp > ammount) temp = 1; if (x[temp] >= x[place]) { showPacC = document.getElementById("pacCE").style; xOff = 10; } else { showPacC = document.getElementById("pacCW").style; xOff = 23; }}function pacPicO(){ temp = place + 1; if (temp > ammount) temp = 1; if (x[temp] >= x[place]) { showPacO = document.getElementById("pacOE").style; xOff = 10; } else { showPacO = document.getElementById("pacOW").style; xOff = 23; }}function update(e){ wait++; if (wait == waitUntil) { if (times > ammount) { done = true; times = 1; } showPill = document.getElementById("pill" + times + "").style; x[times] = event.x + document.body.scrollLeft - (pillW / 2); showPill.left = x[times]; y[times] = event.y + document.body.scrollTop - (pillH / 2); showPill.top = y[times]; showPill.visibility = "visible"; if (done) { showPacC.visibility = "hidden"; place = times + 1; if (place > ammount) place = 1; pacPicO(); showPacO.left = x[place] - pacOWidth + xOff; showPacO.top = y[place] - (pacOHeight / 2) + 3; showPacO.visibility = "visible"; } times++; wait = 0; } else if (wait == waitUntil / 2 && done) { showPacO.visibility = "hidden"; if (place > ammount) place = 1; pacPicC(); showPacC.left = x[place] - pacCWidth + xOff; showPacC.top = y[place] - (pacCHeight / 2) + 3; showPacC.visibility = "visible"; }} </SCRIPT><!-- This script downloaded from www.JavaScriptBank.com Come to view and download over 2000+ free javascript at www.JavaScriptBank.com-->
http://javascriptbank.com/javascript/mouse/Pacman/Pacman_images.zip