博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
mootools_MooTools,Mario和Portal
阅读量:2511 次
发布时间:2019-05-11

本文共 3806 字,大约阅读时间需要 12 分钟。

mootools

Mario

I'm a big fan of video games. I don't get much time to play them but I'll put down the MacBook Pro long enough to get a few games in. One of my favorites is Portal. For those who don't know, what's wrong with you? Portal is a strategic game that requires a lot of thinking and good timing. You get two "portal guns" which allow you to get from place to place. Check out .

我是电子游戏的忠实粉丝。 我没有太多时间来玩这些游戏,但是我会放下MacBook Pro足够长的时间来玩一些游戏。我最喜欢的游戏之一是Portal。 对于那些不知道的人, 你怎么了? 门户网站是一项战略游戏,需要大量的思考和良好的时机。 您会得到两把“门炮”,可以让您到处走动。 查看 。

While Portal now has a place in my heart, it needs to share space with the original Mario games. Don't ask me why, but I got the idea of combining the two in my head. And I'm not a video game programmer so I needed to rock MooTools to accomplish it. It was actually quite simple.

虽然Portal现在在我心中占有一席之地,但它需要与原始Mario游戏共享空间。 不要问我为什么,但是我想到了将两者结合在一起的想法。 而且我不是视频游戏程序员,所以我需要摇滚MooTools来完成它。 实际上很简单。

XHTML (The XHTML)

Left Pipe
Right Pipe
Mario!
Mario!

Just a stage and some imagery which will be manipulated with CSS and MooTools JavaScript.

只是一个阶段和一些图像,这些图像将通过CSS和MooTools JavaScript进行处理。

CSS (The CSS)

#stage		{ width:600px; height:250px; position:relative; background:#5573EB; }#stage img	{ display:block; }#tube-left	{ position:absolute; bottom:0; left:100px; z-index:5; }#tube-right	{ position:absolute; bottom:0; right:100px; z-index:5; }#mario-left	{ position:absolute; bottom:0; left:110px; z-index:3; }#mario-right { position:absolute; bottom:0; right:110px; z-index:3; }#baddy		{ position:absolute; bottom:30px; left:180px; z-index:5; }#box		{ position:absolute; bottom:130px; left:290px; z-index:5; }#floor		{ position:absolute; bottom:0; left:0; height:30px; width:600px; background:url(mario-floor.png) 0 0; right:0; }

The absolute positioning is key here. The hardest part is measuring things up -- once you've got that, you're golden. Also be sure that the pipes have a larger z-index than the Marios.

绝对定位是这里的关键。 最难的部分是进行测量-一旦掌握了这些,就变得很黄金。 另外,请确保管道的z索引大于Marios。

MooTools JavaScript (The MooTools JavaScript)

(function($) {	window.addEvent('domready',function() {		/* the master */		var animation = function() {			/* settings */			var upDuration = 300, downDuration = 500, upHeight = 200, baddyDuration = 10000, rightDistance = 400;			var lefty = $('mario-left'), righty = $('mario-right'), baddy = $('baddy');						/* left animations time! */			var leftFxUp = new Fx.Tween(lefty,{				duration: upDuration,				onComplete: function() { leftFxDown.start('bottom',0); }			}).start('bottom',upHeight);			var leftFxDown = new Fx.Tween(lefty,{				duration: downDuration,				onComplete: function() { rightFxUp.start('bottom',upHeight); }			});						/* right animation time! */			var rightFxUp = new Fx.Tween(righty,{				duration: upDuration,				onComplete: function() { rightFxDown.start('bottom',0); }			});			var rightFxDown = new Fx.Tween(righty,{				duration: downDuration,				onComplete: function() { leftFxUp.start('bottom',upHeight); }			});						/* baddy animation */			var baddyRightFx = new Fx.Tween(baddy,{				duration: baddyDuration,				onComplete: function() { baddyLeftFx.start('left',rightDistance); }			});			var baddyLeftFx = new Fx.Tween(baddy,{				duration: baddyDuration,				onComplete: function() { baddyRightFx.start('left',180); }			}).start('left',rightDistance);					};					/* ACTION! */		animation();	});})(document.id);

The MooTools JavaScript is the fun part. I create 4 Fx.Tween objects that will act as the "up" and "down" animations. Once one finishes, the next one is directed start. So simple!

MooTools JavaScript是有趣的部分。 我创建了4个Fx.Tween对象,它们将充当“向上”和“向下”动画。 一旦完成,将直接开始下一个。 很简单!

I know: ridiculous. It was a great way to mix the old school an new school though!

我知道:可笑。 不过,这是将旧学校与新学校混合的好方法!

翻译自:

mootools

转载地址:http://zupwd.baihongyu.com/

你可能感兴趣的文章
景安快运挂在磁盘-支持宝塔
查看>>
RubyMine 5.4 发布,支持 Rails 4
查看>>
强大的C# Expression在一个函数求导问题中的简单运用
查看>>
word中交叉引用不能更新的解决方法
查看>>
太过于依赖.NET默认的序列化机制
查看>>
Alpine Linux 2.5.0 发布,面向路由器、防火墙
查看>>
quotatool 1.6.2 发布,磁盘配额管理工具
查看>>
CVSps 3.8 发布,CVS 资料库更改收集
查看>>
构造函数,析构函数是否为虚函数
查看>>
Django缓存使用方法
查看>>
html布局
查看>>
并查集
查看>>
高性能HTTP加速器Varnish(概念篇)
查看>>
Linux 如何写makefile文件
查看>>
flutter_webview_plugin 无法加载网页的异常处理
查看>>
bloc控制读写文件
查看>>
微信小程序
查看>>
预培训-阅读-快速阅读并提问
查看>>
拓展KMP以及模板
查看>>
洛谷 P3049 Landscaping ( 贪心 || DP)
查看>>