肆巴士 手游资讯 手游评测 手游超级玛丽,超级马里奥

手游超级玛丽,超级马里奥

时间:2024-05-22 09:47:47 来源:条条 浏览:0

各位老铁们,大家好,今天由我来为大家分享手游超级玛丽,以及超级马里奥的相关问题知识,希望对大家有所帮助。如果可以帮助到大家,还望关注收藏下本站,您的支持是我们最大的动力,谢谢大家了哈,下面我们开始吧!

1、玩法:点击鼠标左键进行马里奥跳跃,带着马里奥跳跃不同的障碍物,统计分数,快去玩变态超级玛丽吧^^。\n

开始游戏

2、<canvasid="gamescene"></canvas>\ncss

#game_div.horizontal{width:680px;height:480px;}\n.horizontal#start{background:transparent;width:680px;height:460px;}\n.horizontal#start.title{margin:15pxauto15px;}\n.horizontal#play{background:transparent;width:680px;height:300px;}\n.horizontal#end{width:680px;height:400px;}\n.horizontal#footer{bottom:0;}\njs

varP=function(canvas,size,procedure){\nvarself=this;\nself.debug=true;\nself.width=size.width;\nself.height=size.height;\nself.director=newP.Director;\nself.loader=newP.Loader;\nself.root=newP.Group(this);\nself.ctx=document.getElementById(canvas).getContext('2d');\nself.camera=newP.Camera(this);\nself.pe=newP.Physics(this);\nself.other={};\nself.other={};\nprocedure.preload&&procedure.preload(this);\nself.loader.waitForComplete(P.Util.proxy(function(){\nprocedure.init&&procedure.init(this);\nprocedure.start&&procedure.start(this);\nself.render(self.ctx);\n},this));\n}\nP.prototype.render=function(ctx){\nvarself=this;\nP.Util.setIntervalWithTimeout(function(){\nctx.clearRect(0,0,ctx.canvas.width,ctx.canvas.height);\nself.camera.update();\nself.renderTree(self.root,ctx);\n},1000/60);\n}\nP.prototype.renderTree=function(node,ctx){\nif(node.img){\nif(node.stype=="normal"){\nvarx=node.x-(this.camera.x);\nvary=node.y-(this.camera.y);\nctx.drawImage(node.img,0+node.width*node.frame,0,\nnode.width,node.height,x,y,node.width,node.height);\n}elseif(node.stype=="repeat-x"){\nvarx=node.x;\nvary=node.y-(this.camera.y);\nvarstartX=(this.camera.x>node.x)\n?((node.x-this.camera.x)%node.width)\n:(-(node.width+(this.camera.x-node.x)%node.width));\nvarnumber=Math.ceil((this.width-startX)/node.width);\nfor(vari=0;i<number;i++){\nctx.drawImage(node.img,startX+i*node.width,y);\n}\n}elseif(node.stype=="repeat-x-rect"){\nvarpattern=ctx.createPattern(node.img,"repeat-x");\nctx.fillStyle=pattern;\nctx.fillRect(0,0,this.width,this.height);\n}elseif(node.stype=="group"){\n}\n}\nfor(varxinnode.children){\nthis.renderTree(node.children[x],ctx);\n}\n}\n//P.Camera\nP.Camera=function(game){\nthis.x=0;\nthis.y=0;\nthis.padding={\ntop:0\n,right:0\n,bottom:0\n,left:0\n};\nthis.player=null;\nthis.game=game;\n}\nP.Camera.prototype.follow=function(player,playerPosition,stype,options){\nthis.player=player;\nthis.playerPosition=playerPosition;\nthis.stype=stype;\nif(stype=="padding"){\nthis.padding=options;\nvarwidth=this.game.width-options.left-options.right;\nvarheight=this.game.height-options.top-options.bottom;\nthis.x=player.x-(width*playerPosition.x+options.left);\nthis.y=player.y-(height*playerPosition.y+options.top);\n}elseif(stype=="viewport"){\nthis.viewport=options;\nthis.x=player.x-(options.width*playerPosition.x+options.x);\nthis.y=player.y-(options.height*playerPosition.y+options.y);\n}\n}\nP.Camera.prototype.update=function(){\nif(this.player){\nif(this.stype=="padding"){\nif(this.player.x<this.x+this.padding.left){\nthis.x+=this.player.x-(this.x+this.padding.left);\n}elseif(this.player.x>this.x+this.game.width-this.padding.right){\nthis.x+=this.player.x-(this.x+this.game.width-this.padding.right);\n}\nif(this.player.y<this.y+this.padding.top){\nthis.y+=this.player.y-(this.y+this.padding.top);\n}elseif(this.player.y>this.y+this.game.height-this.padding.bottom){\nthis.y+=this.player.y-(this.camera.y+this.game.height-this.padding.bottom);\n}\n}elseif(this.stype=="viewport"){\nif(this.player.x<this.x+this.viewport.x){\nthis.x+=this.player.x-(this.x+this.viewport.x);\n}elseif(this.player.x>this.x+this.game.width-\n(this.game.width-this.viewport.x-this.viewport.width)){\nthis.x+=this.player.x-(this.x+this.game.width-\n(this.game.width-this.viewport.x-this.viewport.width));\n}\nif(this.player.y<this.y+this.viewport.y){\nthis.y+=this.player.y-(this.y+this.viewport.y);\n}elseif(this.player.y>this.y+this.game.height-\n(this.game.height-this.viewport.y-this.viewport.height)){\nthis.y+=this.player.y-(this.camera.y+this.game.height-\n(this.game.height-this.viewport.y-this.viewport.height));\n}\n}\n}\n}\nP.Physics=function(game){\nthis.game=game;\nthis.loop=null;\nthis.gravity=0;\nthis.children={};\nthis.isRunning=false;\n}\nP.Physics.prototype.start=function(){\nvarself=this;\nself.isRunning=true;\nself.loop=P.Util.setIntervalWithTimeout(function(){\nself.update();\n},1000/60);\n}\nP.Physics.prototype.stop=function(){\nP.Util.clearIntervalWithTimeout(this.loop);\nthis.loop=null;\nthis.isRunning=false;\n}\n

源码

3、转载:欢迎来到本站,转载请注明文章出处https://ormcc.com/

文章到此结束,如果本次分享的手游超级玛丽和超级马里奥的问题解决了您的问题,那么我们由衷的感到高兴!

标题:手游超级玛丽,超级马里奥
链接:https://www.si84.com//news/sypc/185658.html
版权:文章转载自网络,如有侵权,请联系删除!
资讯推荐
更多
绯红之境兑换码最新2021 礼包兑换码大全

绯红之境兑换码最新2021 礼包兑换码大全[多图],绯红之境兑换码怎么领取?绯红之境兑换码有哪些?绯红之境在今日

2024-05-22
妄想山海怎么加好友 加好友方法大全

妄想山海怎么加好友 加好友方法大全[多图],妄想山海添加好友功能在哪里?妄想山海添加好友的方法是什么?好友添

2024-05-22
欢乐射手能提款吗 欢乐射手领红包是真的吗

欢乐射手能提款吗 欢乐射手领红包是真的吗[多图],欢乐射手能提款吗?欢乐射手领红包是真的吗?欢乐射手最近的广

2024-05-22
上古卷轴刀锋好玩吗?上古卷轴刀锋游戏评测

上古卷轴刀锋好玩吗?上古卷轴刀锋游戏评测[多图],上古卷轴刀锋游戏怎么样?想要知道游戏好不好玩,那么大家就要

2024-05-22