查看: 1640|回复: 8
|
[分享] 一个烟火效果
[复制链接]
|
|
发表于 31-12-2004 01:16 PM
|
显示全部楼层
简单弄了一个,我想应该是你想要的
Flash: http://xenz.flash8.net/examples/firework.swf
MovieClip.prototype.onFire = function(x, y) {
for (var i = 0; i<30; i++) {
var depth = this.getNextHighestDepth();
var fire = this.attachMovie("firework", "firework"+depth, depth);
var myColor = new Color(fire);
myColor.setRGB(_root.c[this.count]);
delete myColor;
fire._x = x;
fire._y= y;
fire._xscale = fire._yscale=25+random(75);
fire._rotation = random(10)+i*11;
}
this.count++;
if(this.count >3) {
clearInterval(this.time);
}
}
onMouseDown = function() {
var obj = this.createEmptyMovieClip("f"+this.getNextHighestDepth(), this.getNextHighestDepth());
obj.count = 0;
obj.onFire(_xmouse, _ymouse);
obj.time = setInterval(obj, "onFire", 1300, _xmouse, _ymouse);
}
var c = new Array(0x66FF00, 0xFF00CC, 0x3333FF, 0xFFFF00);
源文件 http://xenz.flash8.net/examples/firework.rar |
|
|
|
|
|
|
|
发表于 31-12-2004 01:34 PM
|
显示全部楼层
if(this.count > _root.c.length-1) { //换成这样比较方便
clearInterval(this.time);
delete this;
} |
|
|
|
|
|
|
|
楼主 |
发表于 31-12-2004 03:38 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 31-12-2004 04:40 PM
|
显示全部楼层
那么你必须先提供你是如何移动你的贪吃蛇,然后才能够提供你增加速度的方法 |
|
|
|
|
|
|
|
楼主 |
发表于 31-12-2004 04:46 PM
|
显示全部楼层
|
|
|
|
|
|
|
发表于 31-12-2004 05:00 PM
|
显示全部楼层
你的setInterval用法用错了,setInterval只会根据第一次指定的时间执行,之后不会被更动。你可以这样修改
hard = 1; //困难度开始为1
next_level = 10; //指定每10分升一级
if(head0._x==egg0._x && head0._y==egg0._y) {//当蛇吃到蛋的处理
attach_egg=1;
score+=1;
_root.attachMovie("snake","head"+score,score);
mc=eval("head"+score);
mc._cari_x;
mc._y=next_y;
if(int(score/next_level) > hard) {
hard++;
reload();
}
}
function reload() {
clearInterval(showMove);
showMove=setInterval(Move,1000/hard);
}
reload();
[ Last edited by super-tomato on 31-12-2004 at 05:06 PM ] |
|
|
|
|
|
|
|
楼主 |
发表于 31-12-2004 05:11 PM
|
显示全部楼层
哦~回去再试试,2005年还没到就换头像了~谢谢哦 |
|
|
|
|
|
|
|
发表于 1-1-2005 12:19 AM
|
显示全部楼层
|
|
|
|
|
|
| |
本周最热论坛帖子
|