Home Tutorials Forums Articles Blogs Movies Library Employment Press Buy templates

Go Back   ActionScript.org Forums > Community Boards > Just for Kicks Challenges

Reply
 
Thread Tools Rate Thread Display Modes
Old 02-14-2006, 10:03 PM   #1
zap1992
Zappp
 
zap1992's Avatar
 
Join Date: Oct 2005
Location: usa
Posts: 111
Send a message via AIM to zap1992 Send a message via MSN to zap1992 Send a message via Yahoo to zap1992
Talking Explosions!

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
zap1992 is offline   Reply With Quote
Old 02-15-2006, 05:05 PM   #2
invader
Dont set yourself on fire
 
invader's Avatar
 
Join Date: Aug 2005
Location: Arizona, USA
Posts: 238
Send a message via AIM to invader
Default

how about 36 lines? (i recommend using 30+ fps)

ActionScript Code:
size = 100; howMany = 5; function createBoom() {     if (depth>20) {         depth = 0; }     depth++;     createEmptyMovieClip("boom"+depth,depth);     boom = this["boom"+depth];     boom.onEnterFrame = function () {         this.Scale += this.rate;         this._xscale = this.Scale;         this._yscale = this.Scale;         this._alpha = 100 - this.Scale;         if (this.Scale>=100) {             createBoom();             this.removeMovieClip(); } }     boom._xscale = 0;     boom._yscale = 0;     boom.Scale = 0;     boom.rate = 5+Math.random()*10;     boom._x = Math.random()*550;     boom._y = Math.random()*400;     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); } depth=0; for (i=0;i<howMany;i++) {     createBoom(); }
invader is offline   Reply With Quote
Old 02-15-2006, 05:48 PM   #3
falltimemusic
I'm an alright guy
 
falltimemusic's Avatar
 
Join Date: Jun 2005
Location: I live where my rump rests
Posts: 292
Default ...

Im looking through your code and I don't see anything that makes the graphic! Is "boom" a built in graphic or something?
falltimemusic is offline   Reply With Quote
Old 02-16-2006, 01:12 AM   #4
zap1992
Zappp
 
zap1992's Avatar
 
Join Date: Oct 2005
Location: usa
Posts: 111
Send a message via AIM to zap1992 Send a message via MSN to zap1992 Send a message via Yahoo to zap1992
Default

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..
zap1992 is offline   Reply With Quote
Old 02-20-2006, 02:01 AM   #5
zap1992
Zappp
 
zap1992's Avatar
 
Join Date: Oct 2005
Location: usa
Posts: 111
Send a message via AIM to zap1992 Send a message via MSN to zap1992 Send a message via Yahoo to zap1992
Default

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);}}}}}
zap1992 is offline   Reply With Quote
Old 02-21-2006, 02:12 AM   #6
invader
Dont set yourself on fire
 
invader's Avatar
 
Join Date: Aug 2005
Location: Arizona, USA
Posts: 238
Send a message via AIM to invader
Default

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:
createEmptyMovieClip("myName",this.getNextHighestDepth());
then you can draw with it:
ActionScript Code:
createEmptyMovieClip("myName",this.getNextHighestDepth()); myName.lineStyle(0); // sets the appearance of the line myName.moveTo(size,0); // moves the position where it starts drawing size=100; 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); myName.curveTo(x,y,ax,ay); } // draws a curve to the next point. you can also use .lineTo() x = .1*size*Math.cos((a-.5)*Math.PI/6); y = .1*size*Math.sin((a-.5)*Math.PI/6); myName.curveTo(x,y,size,0); }
invader is offline   Reply With Quote
Old 02-22-2006, 01:47 AM   #7
zap1992
Zappp
 
zap1992's Avatar
 
Join Date: Oct 2005
Location: usa
Posts: 111
Send a message via AIM to zap1992 Send a message via MSN to zap1992 Send a message via Yahoo to zap1992
Default

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);}}}}}}
And of course for those of you who are amazingly laz, the automated version...(Sorry, i didn't format it for minimal lines so... it hits 68 )
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..
zap1992 is offline   Reply With Quote
Old 06-01-2006, 12:11 PM   #8
daly3721
Registered User
 
Join Date: Jun 2006
Posts: 1
Default

Quote:
Originally Posted by zap1992
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);}}}}}}
And of course for those of you who are amazingly laz, the automated version...(Sorry, i didn't format it for minimal lines so... it hits 68 )
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);
                    }
                }
            }
        }
    }
}
i am from huangshi,hb,china - a pretty tiny city,it is wonderful here .i am learning .
daly3721 is offline   Reply With Quote
Old 06-02-2006, 02:13 AM   #9
TeddyKrulewich
I love trumpet/computers
 
TeddyKrulewich's Avatar
 
Join Date: May 2006
Posts: 97
Default

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();
TeddyKrulewich is offline   Reply With Quote
Old 06-21-2006, 01:21 PM   #10
jclarke
Senior Member
 
jclarke's Avatar
 
Join Date: Oct 2005
Posts: 229
Talking

Hey guys i though i'd give it a go attached is my explosion effect!
Attached Files
File Type: zip explotion.zip (6.4 KB, 257 views)
jclarke is offline   Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

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


All times are GMT. The time now is 05:28 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Ad Management plugin by RedTyger
Copyright 2000-2009 ActionScript.org. All Rights Reserved.
Your use of this site is subject to our Privacy Policy and Terms of Use.