5D艺术网首页
商城
|
资讯
|
作品
|
博客
|
教程
|
论坛
登录
注册
加为好友
发短消息
来自:北京
性别:先生
最后登录:2014-08-29
http://veteran.5d.cn/
www.toswf.com
首页
|
新闻
|
话题
|
博客
|
相册
|
艺术作品
|
社交关系
|
留言板
|
社交圈
2005/12/14 | 射击类游戏的开发过程(Flash)(八)
类别(Flash)
|
评论
(0)
|
阅读(69)
|
发表于 14:04
9、敌机的曲线飞行
这里要说到的是一种比较简单的锯齿飞行路线,直线的飞行是修改X轴的属性,锯齿飞行需要修改y轴的属
性,只需要y轴的值在一个较小的范围内变化就可达到这个目的。
先确定一下飞行的最高点和最低点(以当前的y轴为基点):
maxH=this._y+100;
minH=this._y-100;
飞行的速度:
upspeed=2;
--------------------
this._y += upspeed;
if (this._y > maxH)
{
upspeed = -2;
}
else if (this._y < minH)
{
upspeed = 2;
}
根据范围来修改upspeed的值。
完整的代码是这样的:
onClipEvent (enterFrame)
{
this._x -= enemySpeed;
this._y += upspeed;
if (this._y > maxH)
{
upspeed = -2;
}
else if (this._y < minH)
{
upspeed = 2;
}
if (this._x < -10)
{
reset();
}
if (this.hitTest(_root.hero))
{
_root.gotoAndStop(2);
}
}
0
这条日志目前没有评论.
立即注册5D通行证
Join 5D!
发表留言
post
正在发送...
Send...
游客
Guest
用 户
Name
:
密 码
Password
:
内 容
Comment
:
主 页
Homepage
:
验 证
Verify
:
换一个
change the code
日志分类
首页
[185]
Flash
[123]
ColdFusion
[2]
Flex
[2]
FlashMedia
[3]
RIA
[4]
Other
[43]
Python
[0]
Design
[8]