教你详细制作flash游戏青蛙(附源代码)

游戏的最终效果
[1b]相关教程[/1b]
一.青蛙跳动起来!
[url=http://www.mygamemylove.com/105.html]
[color="#0000ff"]http://www.mygamemylove.com/105.html[/color]
[/url]
二.来回移动的荷叶。
[url=http://www.mygamemylove.com/104.html]
[color="#0000ff"]http://www.mygamemylove.com/104.html[/color]
[/url]
三.修改"来回移动的荷叶”
[url=http://www.mygamemylove.com/103.html]
[color="#0000ff"]http://www.mygamemylove.com/103.html[/color]
[/url]
四.跳上荷叶!
[url=http://www.mygamemylove.com/106.html]
[color="#0000ff"]http://www.mygamemylove.com/106.html[/color]
[/url]
五.背景的移动
[url=http://www.mygamemylove.com/102.html]
[color="#0000ff"]http://www.mygamemylove.com/102.html[/color]
[/url]
六.更像是跳到荷叶
[url=http://www.mygamemylove.com/101.html]
[color="#0000ff"]http://www.mygamemylove.com/101.html[/color]
[/url]
七.加上开始,结束
[url=http://www.mygamemylove.com/100.html]
[color="#0000ff"]http://www.mygamemylove.com/100.html[/color]
[/url]
八.增加游戏的可玩性(吃小虫)。
[url=http://www.mygamemylove.com/99.html]
[color="#0000ff"]http://www.mygamemylove.com/99.html [/color]
[/url]
九.添加平面,效果.
[url=http://www.mygamemylove.com/demo/qingwua/98.swf]
[color="#0000ff"]http://www.mygamemylove.com/demo/qingwua/98.swf[/color]
[/url]
[1b]一.青蛙跳动起来![/1b]
先完成的当然就是青蛙的跳动了,因为我们是以俯视的的角度,所以高低的状态就是尺寸的大小,移动就是y坐标的减

效果及源代码下载:
[url=http://www.mygamemylove.com/105.html]
[color="#0000ff"]http://www.mygamemylove.com/105.html[/color]
[/url]
代码及相关注释:
代码如下:
//游戏的最大深度,后面会用的,要设一下最大的尝试,因为我们用到一个鼠标拖动。
var numMaxDepth:Number = 1000;
//跳动的过程############################
//青蛙mc名称
var mcPlayer:MovieClip;
//移动
function playerMove() {
//这是自定义的一个从初使值到最高值,再以同样的增量回到初值的类,要结合onEnterFrame循环来移动。
//new casUpTopDown(10) 移动次数
mcPlayer.objUpTopDown = new casUpTopDown(10);
//速度
mcPlayer.numSD = 10;
//什么时候开始
mcPlayer.numStar = 100;
//青蛙移动的速度
mcPlayer.numMoveSd=4
//循环来移动
mcPlayer.onEnterFrame = function() {
  if (this.objUpTopDown.run() != 0) {
   this._xscale = this._yscale=(this.numStar+this.objUpTopDown.run()*this.numSD);
   this._y-=this.numMoveSd
  } else {
//释放资源
   delete (this.onEnterFrame);
   delete (this.objUpTopDown);
   delete (this.numSD);
   delete (this.numStar);
   delete (this.numMoveSd);
  }
};
}
//
//鼠标#############################
//mouseStyle, 鼠标样式
_root.attachMovie("mouse", "mouseStyle", numMaxDepth);
var objMouse:Object = new Object();
// onMouseDown、onMouseMove、onMouseUp 和 onMouseWheel
objMouse.onMouseDown = function() {
//trace("按下");
};
objMouse.onMouseMove = function() {
//trace("移动");
_root.mouseStyle._x = _xmouse;
_root.mouseStyle._y = _ymouse;
本文转自:http://www.5uflash.com/flashjiaocheng/Flashyingyongkaifa/560.html
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值