当前位置: 首页 > 图文教程 > Flash动画 > Flash动画制作 > Flash动画实例:简单的流星雨动画特效

Flash动画制作
我是大导演 MTV创作速成教程
二合一按钮的制作
[DIY]这种相册你有吗?
教你一招绝的!把Flash动画转换成VCD视频
使用Flash MX的3个小技巧
Flash课件一网打尽
Flash Player 7 安全策略解析
FlashMX特效之扩散与挤压
Flash MX 2004 体验之旅
Flash使用技巧--用Flash制作拖拉式菜单
Flash使用技巧--用Flash制作转动的地球仪
Flash使用技巧--用Flash 5制作Winamp光谱柱的效果
Flash使用技巧--用Flash制作落地有声的瓶子
Flash使用技巧--用Flash 5巧做“弹出”效果菜单
Flash使用技巧--用Flash制作即指即现的广告条
用大师级软件MixFX轻松打造专业FLASH
用Flash MX快速制作沟通留言程序
用Flash制作动感效果的网页链接提示框
巧妙运用Flash MX 2004制作“拖曳配对题”
用Flash MX制作精彩的粉荷清波动画特效一例

Flash动画制作 中的 Flash动画实例:简单的流星雨动画特效


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2010-01-04   浏览: 79 ::
收藏到网摘: n/a

看效果:

源码下载:/upload/tech/20100104/20100104135431_0d7de1aca9299fe63f3e0041f02638a3.rar

(这个大家都会做吧)全部过程就一帧代码:

xrandom = new Array();
yrandom = new Array();
salerandom = new Array();
//取得随机速度
speed = Math.floor(Math.random()*10)+5;
for (_global.i=0; i<=19; i++) {
//取得随机横坐标
xrandom = Math.floor(Math.random()*700);
//取得随机纵坐标
yrandom = Math.floor(Math.random()*400);
//取得随机尺码
salerandom = Math.floor(Math.random()*20)+2;
//创建19个彗星
duplicateMovieClip(ball, "ball"+i, i);
_root["ball"+i]._x = xrandom;
_root["ball"+i]._y = yrandom;
_root["ball"+i]._yscale = salerandom;
//流星角度为20
_root["ball"+i]._rotation = 20;
//让流星成20°的弧度位移
_root["ball"+i].onEnterFrame = function() {
  var a = this._rotation;
  var rad = a*Math.PI/180;
  var dx = Math.cos(rad)*speed;
  var dy = Math.sin(rad)*speed;
  this._x += dx;
  this._y += dy;
//若流星超出屏幕,则坐标复原
  if (this._x>=710) {
   this._x = -Math.floor(Math.random()*300);
   this._y = -Math.floor(Math.random()*300);
  }
};
}
//取得ASCII
code = 174;
char = chr(code);
//作者名字
mytext_txt.text = char+" Huanbaiyiju";
*****************************************************
OK啦!
特别说明:
数组是个很有意思的东西,比如想要创建成千上万敌人,就这么做:
enemys = new Array();
for(i=0;i<500;k++){
    enemys.names = "Zerg";
    enemys.blood =  200;
    enemys.equipment = "sword";
}
敌人的所有属性就简单的定义了。