js实现猜杯子最强眼力闯关关卡小游戏代码
代码语言:html
所属分类:游戏
代码描述:js实现猜杯子最强眼力闯关关卡小游戏代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <meta charset="UTF-8"> <meta name="apple-mobile-web-app-capable" content="yes"> <meta name="robots" content="index,follow"> <meta name="viewport" content="width=device-width; initial-scale=1.0; maximum-scale=1.0; user-scalable=no;"> <title>最强眼力</title> <style> body,html{margin:0;padding:0;font-family:Helvetica,Arial,Verdana,sans-serif;font-size:10px;-webkit-text-size-adjust:none;background-color:#222}h2{font-weight:bold;font-size:1.8em;line-height:1.8em;padding:0 .5em}a{text-decoration:none}header>nav,footer>nav{font-size:1.3em;text-align:center}header>nav>ul>li,footer>nav>ul>li{border-top:1px solid #333;border-left:1px solid #333;border-bottom:1px solid #333;display:inline-block;height:3em;padding:0 1em;line-height:3em;margin-left:-.4em}header>nav>ul>li:first-child,footer>nav>ul>li:first-child{margin-left:0}header>nav>ul>li:last-child,footer>nav>ul>li:last-child{border-right:1px solid #333}header{margin:1em 0 .5em}header>nav>ul{border-bottom:1px solid #333}header>nav>ul>li{margin-bottom:-1px}footer{clear:both;margin:0 0 1em}footer>nav>ul{border-top:1px solid #333}footer>nav>ul>li{margin-top:-1px}footer>p{margin:1em 0;text-align:center}#content>nav>ul>li,#content>ol>li{position:relative;border-bottom:1px solid #333;height:7.5em;padding:.5em;overflow:hidden}#content>nav>ul>li:last-child,#content>ol>li:last-child{border-bottom:none}#content>nav>ul>li>a>img,#content>ol>li>img{float:left;margin-right:.5em}#content>nav>ul>li>h3,#content>ol>li>h3{font-weight:bold;font-size:1.3em;padding:.2em 1em .5em}#content>nav>ul>li>p,#content>ol>li>p{font-size:1.2em}#content>ol>li.message{height:3em;margin:1em;line-height:3em;padding:0 1em}#content>ol>li.loading,#content>ol>li.info{border:2px solid #6BA5EF !important;font-size:1.3em !important;color:#1B427A !important;background-color:#94C6F7 !important}a.jump.faq.link{background-image:-webkit-gradient( linear,left bottom,left top,color-stop(0.04,rgb(156,25,25)),color-stop(0.86,rgb(255,174,0)) );background-image:-moz-linear-gradient( center bottom,rgb(156,25,25) 4%,rgb(255,174,0) 86% );border:1px solid rgb(156,25,25);border-radius:0.5em 0.5em 0.5em 0.5em;color:#FFFFFF;display:none;font-weight:bold;line-height:2em;margin:0 0.5em 0.5em;text-align:center}p.faq.intro,dl.faq.list{margin:1em 0;padding:0 0.5em}dl.faq.list>dt{font-weight:bolder;padding:1em 0}dl.faq.list>dd{padding-left:1.5em}a.jump.game.play{display:block;text-align:center;margin:1em;height:3em;line-height:3em;font-size:1.5em;font-weight:bold}#carasoul{margin:0 auto;width:320px;padding:10px 0;position:relative}#carasoul #carasoulBottomNavigation{display:none}#carasoul .sideNav{height:50px;width:30px}#carasoul .sideNav span{display:none}#carasoul #gamesOverview{overflow:hidden;width:260px;margin:0 auto}#carasoul ol{-webkit-transition:all 0.5s ease-in-out;width:960px;padding:0;margin:0}#carasoul ol li{list-style:none;margin:0;float:left}#carasoulLeft{position:absolute;left:0;background:url("arrow-left-gray.html")/*tpa=http://wx.9ku.com/skel/images/arrow-left-gray.html*/ center left no-repeat}#carasoulRight{position:absolute;right:0;background:url("arrow-right-gray.html")/*tpa=http://wx.9ku.com/skel/images/arrow-right-gray.html*/ center right no-repeat}#carasoul nav{padding-top:10px;clear:both}#carasoul nav ul{margin:0;padding:0;display:none;text-align:center}#carasoul nav ul li{margin:0;list-style:0;display:inline-block;list-style-type:none}#carasoul nav ul li a span{display:none}#carasoul nav ul li a{background:url("carasoul-navigation.html")/*tpa=http://wx.9ku.com/skel/images/carasoul-navigation.html*/;display:inline-block;height:16px;width:16px}#carasoul nav ul li.active a{background:url("carasoul-navigation-active.html")/*tpa=http://wx.9ku.com/skel/images/carasoul-navigation-active.html*/}*{-webkit-tap-highlight-color:rgba(0,0,0,0) !important;-webkit-tap-highlight-color:transparent;-webkit-user-select:none;-webkit-focus-ring-color:rgba(0,0,0,0) !important;outline:none !important}body{background:#222222}.main{text-align:center;padding:0;margin:0 auto;background:#222222;width:320px;height:480px}#frame{width:320px;height:480px;margin:0;padding:0;border-top:solid 1px #222222}#canvas{margin:100px 0 0 0;width:320px;height:240px;z-index:-1}#logo{width:260px;height:40px;margin:210px 0 0 30px;background:url("//repo.bfw.wiki/bfwrepo/images/game/yanli/2000-1.png")/*tpa=http://t2.qpic.cn/mblogpic/20aafbe38b6ba434322c/2000*/ no-repeat 0 0}#playButton{width:145px;height:60px;margin:200px 0 0 87px;background:transparent url("//repo.bfw.wiki/bfwrepo/images/game/yanli/2000-1.png")/*tpa=http://t2.qpic.cn/mblogpic/20aafbe38b6ba434322c/2000*/ no-repeat 0 -40px}#playButton:hover{cursor:pointer}#level,#lives{font-size:18px;font-family:Helvetica,Arial,Verdana,Microsoft Yahei,微软雅黑,STXihei,华文细黑,sans-serif;color:#fff}#level{text-align:left;position:absolute;padding:5px}#lives{padding:5px;text-align:right;position:absolute;width:310px}#hearts{float:right;margin-left:10px}.heart{background:url("//repo.bfw.wiki/bfwrepo/images/game/yanli/2000-1.png")/*tpa=http://t2.qpic.cn/mblogpic/20aafbe38b6ba434322c/2000*/ no-repeat -216px -46px;width:28px;height:24px;display:block;float:left}#livesLabel{float:right}@font-face{font-family:Helvetica,Arial,Verdana,Microsoft Yahei,微软雅黑,STXihei,华文细黑,sans-serif}#msg{font-size:18px;font-family:Helvetica,Arial,Verdana,Microsoft Yahei,微软雅黑,STXihei,华文细黑,sans-serif;color:#fff;width:100%;text-align:center}#b1,#b2,#b3{position:absolute;width:88px;height:100px;background:transparent;display:none;z-index:500}#b1{margin:140px 0 0 16px}#b2{margin:140px 0 0 115px}#b3{margin:140px 0 0 216px}#b1:hover,#b2:hover,#b3:hover{cursor:pointer}#tab{margin-top:100} body{oncontextmenu:return false;onselectstart:return false}#play68box{width:190px;font-size:12px;line-height:15px;right:-172px;top:35%;position:fixed;z-index:100}#tab{float:left;list-style:none outside none;padding:0;position:relative;z-index:99;margin-top:10px;margin-right:0;margin-bottom:0;margin-left:0}#tab li span{display:block;padding:0 5px;position:relative}#links{width:100px;padding:1px;float:left;background-color:#f6bb42;border-radius:8px}.show,.hide{transition:margin-right .4s ease-in;-webkit-transition:margin-right .4s ease-in}.hide{margin-right:0px}.show{margin-right:95px}#arrow,.bt{cursor:pointer}.bt{width:95px;height:41px;margin:2px;text-align:center;font:bold 15px Arial,Helvetica,"Microsoft Yahei","΢ÈíÑźÚ",STXihei,"»ªÎÄϸºÚ",sans-serif;background-color:#da4453;border-radius:6px}.bt a{line-height:40px;color:#fff;display:block;text-decoration:none}.bt:hover{transition:background .3s linear -o-transition:background .3s linear;-moz-transition:background .3s linear;-webkit-transition:background .3s linear;background-color:#37bc9b}#deco{width:90px;float:left}#share-wx{background:rgba(0,0,0,0.8);position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:10000;display:none}#wx-qr{background:rgba(0,0,0,0.8);position:absolute;top:0px;left:0px;width:100%;height:100%;z-index:10000;display:none} </style> <script> document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() { WeixinJSBridge.call('showOptionMenu'); }); var moreGamesLocation = ''; function play68_init() { updateShare(0);} function updateShare(bestScore) { imgUrl = '2000.png'; lineLink = 'index.htm' descContent = "考考你的眼力!你的眼睛跟得上吗?"; updateShareScore(bestScore);appid = ''; } function updateShareScore(bestScore) { if(bestScore > 0) {shareTitle = "我玩《最强眼力》过了" + bestScore + "关,眼都花了!";} else{shareTitle = "不玩《最强眼力》怎么知道自己的眼力原来那么好?";} } </script> </head> <body class="os-windows osv-6_1 osmv-6" onorientationchange="orentationChanged()"> <DIV class="main"> <div id="frame"> <div id="logo" style="display: none; opacity: 0;"></div> <div id="playButton" style="display: none; opacity: 1;"></div> <div id="level" style="display: none;"> <span id="levelLabel">关卡:</span> <span id="levelNum">1</span> </div> <div id="lives" style="display: none;"> <div id="hearts"> <div class="heart"> </div> <div class="heart"> </div> <div class="heart"> </div> </div> <div id="livesLabel">命:</div> </div> <div id="b" style="display: block;"> <div style="display: block;" id="b1"></div> <div style="display: block;" id="b2"></div> <div style="display: block;" id="b3"></div> </div> <canvas height="240" width="320" id="canvas" style="display: block;"></canvas> <div id="msg" style="position:relative;display: block; opacity: 1;bottom:50px;"></div> </div> <div style="position:relative; display: block; margin: 0px auto;bottom:120px;z-index:20000"> 变态考反应游戏《密室逃脱》能通关你就能闪子弹了!</div> <script type="text/javascript" > function Delegate(){} Delegate.create=function(o,f){var a=new Array();var l=arguments.length;for(var i=2;i<l;i++)a[i-2]=arguments[i];return function(){var aP=[].concat(arguments,a);f.apply(o,aP);}} Tween=function(obj,prop,func,begin,finish,duration,suffixe){this.init(obj,prop,func,begin,finish,duration,suffixe)} var t=Tween.prototype;t.obj=new Object();t.prop='';t.func=function(t,b,c,d){return c*t/d+b;};t.begin=0;t.change=0;t.prevTime=0;t.prevPos=0;t.looping=false;t._duration=0;t._time=0;t._pos=0;t._position=0;t._startTime=0;t._finish=0;t.name='';t.suffixe='';t._listeners=new Array();t.setTime=function(t){this.prevTime=this._time;if(t>this.getDuration()){if(this.looping){this.rewind(t-this._duration);this.update();this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});}else{this._time=this._duration;this.update();this.stop();this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});}}else if(t<0){this.rewind();this.update();}else{this._time=t;this.update();}} t.getTime=function(){return this._time;} t.setDuration=function(d){this._duration=(d==null||d<=0)?100000:d;} t.getDuration=function(){return this._duration;} t.setPosition=function(p){this.prevPos=this._pos;var a=this.suffixe!=''?this.suffixe:'';this.obj[this.prop]=Math.round(p)+a;this._pos=p;this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});} t.getPosition=function(t){if(t==undefined)t=this._time;return this.func(t,this.begin,this.change,this._duration);};t.setFinish=function(f){this.change=f-this.begin;};t.getFinish=function(){return this.begin+this.change;};t.init=function(obj,prop,func,begin,finish,duration,suffixe){if(!arguments.length)return;this._listeners=new Array();this.addListener(this);if(suffixe)this.suffixe=suffixe;this.obj=obj;this.prop=prop;this.begin=begin;this._pos=begin;this.setDuration(duration);if(func!=null&&func!=''){this.func=func;} this.setFinish(finish);} t.start=function(){this.rewind();this.startEnterFrame();this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});} t.rewind=function(t){this.stop();this._time=(t==undefined)?0:t;this.fixTime();this.update();} t.fforward=function(){this._time=this._duration;this.fixTime();this.update();} t.update=function(){this.setPosition(this.getPosition(this._time));} t.startEnterFrame=function(){this.stopEnterFrame();this.isPlaying=true;this.onEnterFrame();} t.onEnterFrame=function(){if(this.isPlaying){this.nextFrame();setTimeout(Delegate.create(this,this.onEnterFrame),0);}} t.nextFrame=function(){this.setTime((this.getTimer()-this._startTime)/1000);} t.stop=function(){this.stopEnterFrame();this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});} t.stopEnterFrame=function(){this.isPlaying=false;} t.continueTo=function(finish,duration){this.begin=this._pos;this.setFinish(finish);if(this._duration!=undefined) this.setDuration(duration);this.start();} t.resume=function(){this.fixTime();this.startEnterFrame();this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});} t.yoyo=function(){this.continueTo(this.begin,this._time);} t.addListener=function(o){this.removeListener(o);return this._listeners.push(o);} t.removeListener=function(o){var a=this._listeners;var i=a.length;while(i--){if(a[i]==o){a.splice(i,1);return true;}} return false;} t.broadcastMessage=function(){var arr=new Array();for(var i=0;i<arguments.length;i++){arr.push(arguments[i])} var e=arr.shift();var a=this._listeners;var l=a.length;for(var i=0;i<l;i++){if(a[i][e]) a[i][e].apply(a[i],arr);}} t.fixTime=function(){this._startTime=this.getTimer()-this._time*1000;} t.getTimer=function(){return new Date().getTime()-this._time;} Tween.backEaseIn=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;} Tween.backEaseOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;} Tween.backEaseInOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;} Tween.elasticEaseIn=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;} else var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;} Tween.elasticEaseOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;} else var s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);} Tween.elasticEaseInOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)var p=d*(.3*1.5);if(!a||a<Math.abs(c)){var a=c;var s=p/4;} else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;} Tween.bounceEaseOut=function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}} Tween.bounceEaseIn=function(t,b,c,d){return c-Tween.bounceEaseOut(d-t,0,c,d)+b;} Tween.bounceEaseInOut=function(t,b,c,d){if(t<d/2)return Tween.bounceEaseIn(t*2,0,c,d)*.5+b;else return Tween.bounceEaseOut(t*2-d,0,c,d)*.5+c*.5+b;} Tween.strongEaseInOut=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;} Tween.regularEaseIn=function(t,b,c,d){return c*(t/=d)*t+b;} Tween.regularEaseOut=function(t,b,c,d){return-c*(t/=d)*(t-2)+b;} Tween.regularEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;} Tween.strongEaseIn=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;} Tween.strongEaseOut=function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;} Tween.strongEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;} OpacityTween.prototype=new Tween();OpacityTween.prototype.constructor=Tween;OpacityTween.superclass=Tween.prototype;function OpacityTween(obj,func,fromOpacity,toOpacity,duration){this.targetObject=obj;this.init(new Object(),'x',func,fromOpacity,toOpacity,duration);} var o=OpacityTween.prototype;o.targetObject={};o.onMotionChanged=function(evt){var v=evt.target._pos;var t=this.targetObject;t.style['opacity']=v/100;t.style['-moz-opacity']=v/100;if(t.filters)t.filters.alpha['opacity']=v;} var w = 320; var h = 480; var cw = 320; var ch = 240; var fps = 1e3 / 30; var canvas, context, levelCount, imageSprite, timeout; var strings = { witr: "猜猜金币在哪儿?<br>(请选择)", fail: ["是不是眼花了?", "别瞎猜,看准了再选", "太快了吗?"], ok: ["这个太简单了", "还不错,不过这只是练习!", "你确定没有使诈?", "好", "再接再厉", "很好", "太棒了", "下一关会更难哦", "牛逼!", "不可思议", "太夸张了吧", "太厉害了有木有??", "你是怎么做到的?!", "肯定是运气!", "你的眼力那么好,你家人知道吗?", "不会再让你过关的,小心哦!", "简直无法置信!", "从来没有人能到这一关", "大神,教教我你的诀窍吧!", "我不玩了!我不玩了!"] }; var init = function() { imageSprite = new Image; imageSprite.src = "//repo.bfw.wiki/bfwrepo/images/game/yanli/2000-5.png"; play68_init(); welcomeView() }; var welcomeView = function() { var e = document.getElementById("logo".........完整代码请登录后点击上方下载按钮下载查看
网友评论0