| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Zappp
|
Lets see.... Any type of explosion including volcanoes, particles, bombs, fades, and just about anything you can think of... I think this should be 50 lines or less as to allow for a full spectrum of..... scripts. Let the games begin?
Note: I will post my 'entry' ASAP |
|
|
|
|
|
#2 |
|
Dont set yourself on fire
|
how about 36 lines? (i recommend using 30+ fps)
ActionScript Code:
|
|
|
|
|
|
|
|
|
#3 |
|
I'm an alright guy
Join Date: Jun 2005
Location: I live where my rump rests
Posts: 292
|
Im looking through your code and I don't see anything that makes the graphic! Is "boom" a built in graphic or something?
|
|
|
|
|
|
#4 |
|
Zappp
|
boom.lineStyle(0);
boom.moveTo(size,0); for(a=1;a<12;a++) { x = .1*size*Math.cos((a-.5)*Math.PI/6); y = .1*size*Math.sin((a-.5)*Math.PI/6); ax = size*Math.cos(a*Math.PI/6); ay = size*Math.sin(a*Math.PI/6); boom.curveTo(x,y,ax,ay); } x = .1*size*Math.cos((a-.5)*Math.PI/6); y = .1*size*Math.sin((a-.5)*Math.PI/6); boom.curveTo(x,y,size,0); } EDIT:Oooohhh... thats pretty cool (hadn't tried it until now) sorry about my code not existing yet :-P ill get on it Last edited by zap1992; 02-16-2006 at 01:14 AM.. |
|
|
|
|
|
#5 |
|
Zappp
|
Code:
detail = 150;
ticker = -1;
createEmptyMovieClip("particle", 0);
particle.lineStyle(10, 0xCC0000, 50);
particle.lineTo(0, 0);
particle.lineTo(0, .5);
createEmptyMovieClip("background", 1);
background.beginFill(0x000000,100);
background.lineTo(0,0)
background.lineTo(550,0)
background.lineTo(550,400)
background.lineTo(0,400)
background.lineTo(0,0)
function onMouseDown() {
xmouse = _root._xmouse;
ymouse = _root._ymouse;
for (x=2; x<=detail+1; x++) {
particle.duplicateMovieClip("dot"+x, x);
_root["dot"+x].rand = random(100);
_root["dot"+x]._alpha = _root["dot"+x].rand+15;
_root["dot"+x]._width = _root["dot"+x].rand/100*25;
_root["dot"+x]._height = _root["dot"+x].rand/100*25;
_root["dot"+x].angle = (random(80)+230)*Math.PI/180;
_root["dot"+x].distance = 5;
_root["dot"+x].speed = Math.random()*10;
_root["dot"+x].X = xmouse;
_root["dot"+x].Y = ymouse;
_root["dot"+x]._x = xmouse;
_root["dot"+x]._y = ymouse;}}
function onEnterFrame() {
for (x=1; x<=detail+1; x++) {
with (_root["dot"+x]) {
if (speed>=3) {
ang = angle/(Math.PI/180);
angle = ang*(Math.PI/180);
distance += speed;
speed -= .3;
_y = Math.sin(angle)*distance+Y;
_x = Math.cos(angle)*distance+X;
} else {
if (_y<=Y-_width/2) {
speed -= 1;
_y -= speed/2;
diff = X-_x;
_x -= (Math.abs(diff)/diff)*Math.abs(diff/40);}}}}}
|
|
|
|
|
|
#6 |
|
Dont set yourself on fire
|
nice!
sometimes you question people who start challenges but don't include an example. however, i really liked yours. had a bit of a lava look to it. awesome. i did get errors when i tested it. perhaps it's the for() loop in the onEnterFrame starting at x=1, when the dot#'s were created starting at #2 @falltimemusic it uses Flash's drawing API. you can create a movie clip using code: ActionScript Code:
ActionScript Code:
|
|
|
|
|
|
#7 |
|
Zappp
|
fireworks anyone? =D
NOTE: You can have multiple fireworks at once!! but watch out, if you turn up maxbursts too high you get some serious lag (unless you turn down detail that is) Code:
function onLoad() {
//change any of these variables
detail = 150;
angle = -90;
spread = 360;
size = 26;
maxburst = 2;
//Dont change anything below here
countz = -1;
ticker = -1;
createEmptyMovieClip("background", 1);
background.beginFill(0x000000, 100);
background.lineTo(0, 0);
background.lineTo(550, 0);
background.lineTo(550, 400);
background.lineTo(0, 400);
background.lineTo(0, 0);}
function onMouseDown() {explosionsize = random(10) + 5
xmouse = _root._xmouse;
ymouse = _root._ymouse;
createEmptyMovieClip("particle", 0);
particle.lineStyle(10, Math.round(Math.random()*0xFFFFFF+1), 50);
particle.lineTo(0, 0);
particle.lineTo(0, .5);
countz++
if (countz>=maxburst) {countz = 0;}
for (x=2+(countz*detail+1); x<=(countz*detail+1) + detail+1; x++) {
particle.duplicateMovieClip("dot"+x, x);
_root["dot"+x].rand = random(100);
_root["dot"+x]._alpha = _root["dot"+x].rand+15;
_root["dot"+x]._width = _root["dot"+x].rand/100*size;
_root["dot"+x]._height = _root["dot"+x].rand/100*size;
_root["dot"+x].angle = (random(spread)+angle-spread/2)*Math.PI/180;
_root["dot"+x].distance = 5;
_root["dot"+x].speed = Math.random()*2+explosionsize;
_root["dot"+x].X = xmouse;
_root["dot"+x].Y = ymouse;
_root["dot"+x]._x = xmouse;
_root["dot"+x]._y = ymouse;}}
function onEnterFrame() {for (x=2; x<=(detail*maxburst) + 2 && x<= 10000; x++) {if (_root["dot"+x]._name != undefined) {with (_root["dot"+x]) {if (speed>=0) {
ang = angle/(Math.PI/180);
angle = ang*(Math.PI/180);
distance += speed;
speed -= 1;
_y = Math.sin(angle)*distance+Y;
_x = Math.cos(angle)*distance+X;
_alpha -= 3;
} else {if (_y<=Stage.width) {_alpha -= 3;
speed -= 1;
_y -= speed/2;
diff = X-_x;
_x -= (Math.abs(diff)/diff)*Math.abs(diff/100);}}}}}}
Code:
function onLoad() {
//change any of these variables
detail = 150;
angle = -90;
spread = 360;
size = 26;
maxburst = 2;
//Dont change anything below here
countz = -1;
ticker = -1;
createEmptyMovieClip("background", 1);
background.beginFill(0x000000, 100);
background.lineTo(0, 0);
background.lineTo(550, 0);
background.lineTo(550, 400);
background.lineTo(0, 400);
background.lineTo(0, 0);
}
function onEnterFrame() {
if (Math.random()*100<5) {
explosionsize = Math.random()*5+7.5;
xmouse = Math.random()*550;
ymouse = Math.random()*400;
createEmptyMovieClip("particle", 0);
particle.lineStyle(10, Math.round(Math.random()*0xFFFFFF+1), 50);
particle.lineTo(0, 0);
particle.lineTo(0, .5);
countz++;
if (countz>=maxburst) {
countz = 0;
}
for (x=2+(countz*detail+1); x<=(countz*detail+1)+detail+1; x++) {
particle.duplicateMovieClip("dot"+x, x);
_root["dot"+x].rand = random(100);
_root["dot"+x]._alpha = _root["dot"+x].rand+15;
_root["dot"+x]._width = _root["dot"+x].rand/100*size;
_root["dot"+x]._height = _root["dot"+x].rand/100*size;
_root["dot"+x].angle = (random(spread)+angle-spread/2)*Math.PI/180;
_root["dot"+x].distance = 5;
_root["dot"+x].speed = Math.random()*2+explosionsize;
_root["dot"+x].X = xmouse;
_root["dot"+x].Y = ymouse;
_root["dot"+x]._x = xmouse;
_root["dot"+x]._y = ymouse;
}
}
for (x=2; x<=(detail*maxburst)+2 && x<=10000; x++) {
if (_root["dot"+x]._name != undefined) {
with (_root["dot"+x]) {
if (speed>=0) {
ang = angle/(Math.PI/180);
angle = ang*(Math.PI/180);
distance += speed;
speed -= 1;
_y = Math.sin(angle)*distance+Y;
_x = Math.cos(angle)*distance+X;
_alpha -= 3;
} else {
if (_y<=Stage.width) {
_alpha -= 3;
speed -= 1;
_y -= speed/2;
diff = X-_x;
_x -= (Math.abs(diff)/diff)*Math.abs(diff/100);
}
}
}
}
}
}
Last edited by zap1992; 02-22-2006 at 01:56 AM.. |
|
|
|
|
|
#8 | |
|
Registered User
Join Date: Jun 2006
Posts: 1
|
Quote:
![]() |
|
|
|
|
|
|
#9 |
|
I love trumpet/computers
Join Date: May 2006
Posts: 97
|
Here is my explosion. It is based on an explosion class I made almost a month ago. Also this is the first time I've entered some code in a challenge.
Code:
this.createEmptyMovieClip("p0", 100);
p0._x = 275;
p0._Y = 200;
p0.lineStyle(1, 0xff0000, 100);
p0.moveTo(0, 0);
p0.lineTo(0, 3);
pNum = 1000;
function explode() {
for (i=0; i<pNum; ++i) {
duplicateMovieClip("p0", "p"+i, i);
this["p"+i]._alpha=100;
this["p"+i].decay = Math.round(Math.random()*9)+1;
this["p"+i].initXvel = Math.round(Math.random()*-10)+10;
this["p"+i].xvel = this["p"+i].initXvel;
this["p"+i].yvel = Math.round(Math.random()*-10)+10;
this["p"+i]._x = 275+Math.round(Math.random()*-10)+10;
this["p"+i]._y = 200+Math.round(Math.random()*-10)+10;
this["p"+i].onEnterFrame = function() {
this._alpha -= this.decay;
if (this.initXvel<5) {
this._x += this.xvel;
} else {
this._x -= this.xvel;
}
this._y -= this.yvel;
this.xvel -= 1;
this.yvel -= 0.5;
};
}
}
explode();
|
|
|
|
|
|
#10 |
|
Senior Member
Join Date: Oct 2005
Posts: 229
|
Hey guys i though i'd give it a go attached is my explosion effect!
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Unwanted spontaneous explosions | meandmymachine | ActionScript 1.0 (and below) | 2 | 01-04-2004 05:36 PM |
| Explosions | cyscholar | Animation and Effects | 1 | 05-22-2003 12:39 PM |
| actionscripted explosions? | rabsterb | ActionScript 1.0 (and below) | 2 | 05-15-2001 05:17 PM |