Google的PacMan是怎么实现的?

adelezy 2010-05-22 12:21:57
如题
今天是PacMan生日
Google首页挂出了PacMan的游戏
貌似是由一张图片实现的
有没有大牛知道是怎么实现滴咧?
...全文
133 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
shgqin 2011-10-19
  • 打赏
  • 举报
回复
有谁有详细的详解 谢谢
wwttqq85538649 2010-12-09
  • 打赏
  • 举报
回复
你好,我们的课程项目需要开发这个google-pacman,但不知道如何实现,有谁有详细的详解。
adelezy 2010-06-24
  • 打赏
  • 举报
回复
谢谢你
godbull 2010-05-22
  • 打赏
  • 举报
回复
然后是JS部分:
(0.67);if(g.soundReady&&g.graphicsReady){g.updateLoadingProgress(1);g.everythingIsReady()}};g.preloadImage=function(b){var c=new Image,d=google.browser.engine.IE;if(!d)c.onload=g.imageLoaded;c.src=b;d&&g.imageLoaded()};g.imageLoaded=function(){g.graphicsReady=a;g.checkIfEverythingIsReady()};g.prepareGraphics=function(){g.graphicsReady=e;g.preloadImage("/logos/pacman10-hp-sprite.png")};
127g.trimString=function(b){return b.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")};g.g=function(b,c){if(b<c)return-1;else if(b>c)return 1;return 0};
128g.compareVersions=function(b,c){for(var d=0,f=g.trimString(String(b)).split("."),h=g.trimString(String(c)).split("."),j=Math.max(f.length,h.length),k=0;d==0&&k<j;k++){var x=f[k]||"",F=h[k]||"",G=new RegExp("(\\d*)(\\D*)","g"),H=new RegExp("(\\d*)(\\D*)","g");do{var t=G.exec(x)||["","",""],u=H.exec(F)||["","",""];if(t[0].length==0&&u[0].length==0)break;d=t[1].length==0?0:parseInt(t[1],10);var I=u[1].length==0?0:parseInt(u[1],10);d=g.g(d,I)||g.g(t[2].length==0,u[2].length==0)||g.g(t[2],u[2])}while(d==
1290)}return d};g.getFlashVersion=function(b){b=b.match(/[\d]+/g);b.length=3;return b.join(".")};
130g.detectFlash=function(){var b=e,c="";if(navigator.plugins&&navigator.plugins.length){var d=navigator.plugins["Shockwave Flash"];if(d){b=a;if(d.description)c=g.getFlashVersion(d.description)}if(navigator.plugins["Shockwave Flash 2.0"]){b=a;c="2.0.0.11"}}else if(navigator.mimeTypes&&navigator.mimeTypes.length){if(b=(d=navigator.mimeTypes["application/x-shockwave-flash"])&&d.enabledPlugin){c=d.enabledPlugin.description;c=g.getFlashVersion(c)}}else try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
131b=a;c=g.getFlashVersion(d.GetVariable("$version"))}catch(f){try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");b=a;c="6.0.21"}catch(h){try{d=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");b=a;c=g.getFlashVersion(d.GetVariable("$version"))}catch(j){}}}g.hasFlash=b;g.flashVersion=c};g.isFlashVersion=function(b){return g.compareVersions(g.flashVersion,b)>=0};
132g.prepareSound=function(){g.soundAvailable=e;g.soundReady=e;g.detectFlash();if(!g.hasFlash||!g.isFlashVersion("9.0.0.0")){g.soundReady=a;g.checkIfEverythingIsReady()}else{g.flashIframe=document.createElement("iframe");g.flashIframe.name="pm-sound";g.flashIframe.style.position="absolute";g.flashIframe.style.top="-150px";g.flashIframe.style.border=0;g.flashIframe.style.width="100px";g.flashIframe.style.height="100px";google.dom.append(g.flashIframe);g.flashIframeDoc=g.flashIframe.contentDocument;if(g.flashIframeDoc==
133undefined||g.flashIframeDoc==null)g.flashIframeDoc=g.flashIframe.contentWindow.document;g.flashIframeDoc.open();g.flashIframeDoc.write('<html><head></head><body><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0" width="0" height="0" id="pacman-sound-player" type="application/x-shockwave-flash"> <param name="movie" value="logos/swf/pacman10-hp-sound.swf"> <param name="allowScriptAccess" value="always"> <object id="pacman-sound-player-2" type="application/x-shockwave-flash" data="logos/swf/pacman10-hp-sound.swf" width="0" height="0"><param name="allowScriptAccess" value="always"> </object></object></body></html>');
134g.flashIframeDoc.close();window.setTimeout(g.flashNotReady,3E3)}};g.flashNotReady=function(){if(!g.ready){g.soundAvailable=e;g.soundReady=a;g.checkIfEverythingIsReady()}};g.flashReady=function(b){g.flashSoundPlayer=b;g.soundAvailable=a;g.soundReady=a;g.checkIfEverythingIsReady()};
135g.flashLoaded=function(){if(g.flashIframeDoc){var b=g.flashIframeDoc.getElementById("pacman-sound-player");if(b&&b.playTrack){g.flashReady(b);return}else if((b=g.flashIframeDoc.getElementById("pacman-sound-player-2"))&&b.playTrack){g.flashReady(b);return}}g.flashNotReady()};
136g.destroy=function(){if(google.pacman){g.stopAllAudio();window.clearInterval(g.tickTimer);window.clearInterval(g.dotTimer);window.clearInterval(g.dotTimerMs);google.dom.remove(g.styleElement);google.dom.remove(g.flashIframe);google.dom.remove(g.canvasEl);google.pacman=undefined}};g.exportFunctionCalls=function(){google.pacman={};google.pacman.insertCoin=g.insertCoin;google.pacman.flashLoaded=g.flashLoaded;google.pacman.destroy=g.destroy};
137g.updateLoadingProgress=function(b){b=Math.round(b*200);document.getElementById("logo-b").style.width=b+"px"};g.init=function(){g.ready=e;document.getElementById("logo").title="";g.updateLoadingProgress(0.33);g.exportFunctionCalls();g.useCss=navigator.userAgent.indexOf("MSIE 5.")!=-1||navigator.userAgent.indexOf("MSIE 6.")!=-1||navigator.userAgent.indexOf("MSIE 7.")!=-1?e:a;g.prepareGraphics();g.prepareSound()};g.init();
138}();
godbull 2010-05-22
  • 打赏
  • 举报
回复
首先是图片
godbull 2010-05-22
  • 打赏
  • 举报
回复
JS!是JS代码!

10,606

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 其他
社区管理员
  • 其他
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧