Be a Supporter!

AS: FireWorks ;)

  • 5,565 Views
  • 57 Replies
New Topic Respond to this Topic
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
AS: FireWorks ;) 2005-07-23 17:01:49 Reply

This is my AS code for fireworks, PLEASE POST MODS FOR IT!!!!

This uses:
Duplicated MovieClips Basic API Functions Basic Math

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
trace(ref._x+","+ref._y+","+ref);
}
function explode(ref) {
for (i=0; i<40; i++) {
ref["boom"+i].delay = 11;
ref["boom"+i]._rotation = random(30)-15;
ref["boom"+i]._x+=random(50)-25;
ref["boom"+i]._y-=random(50)-25;
ref._rotation=0;
rot = ref["boom"+i]._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref["boom"+i].rot = rot;
ref["boom"+i].onEnterFrame = function() {
this._alpha=random(40)+50+this.delay*3;
if (this.delay>0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x += Math.sin((this.rot/180)*Math.PI)*this.dela
y;
} else if (this.delay<0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x -= Math.sin((this.rot/180)*Math.PI)*this.dela
y/3;
if(this.delay<-20){

removeMovieClip(this._parent);
delete this.onEnterFrame;
}
}
this.delay--;
trace(this._x);
};
}
ref.delay--;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, random(Math.pow(2, 24)), 100);
ref["boom"+i]._alpha = i*(100/40);
ref["boom"+i].moveTo(i, 0);
ref["boom"+i].lineTo(i+1, 1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 20;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
explode(ref);
} else {
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter=_root.counter%6 + 1;
};
Mouse.addListener(b);

Katocan
Katocan
  • Member since: May. 24, 2004
  • Offline.
Forum Stats
Member
Level 19
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:02:17 Reply

very cool

jkhkhj
jkhkhj
  • Member since: Aug. 22, 2003
  • Offline.
Forum Stats
Member
Level 01
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:03:30 Reply

That's teh sex. But you might want to explain it for the noobs.

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:04:39 Reply

You are presuming I care about n00bs in the effects tutorials... bad presumption :P

this one is like denvish's starfield, if you don't understand it don't fuck with it, if you do it'll teach you a thing or 2

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:07:33 Reply

OMG I forgot AS: Main

http://www.newground..229808&page=9999

btriangle
btriangle
  • Member since: Jun. 28, 2005
  • Offline.
Forum Stats
Member
Level 15
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:19:47 Reply

i dont even get it, cause i dont have fireworks but i know what itt does

KaynSlamdyke
KaynSlamdyke
  • Member since: Jun. 25, 2004
  • Offline.
Forum Stats
Member
Level 16
Melancholy
Response to AS: FireWorks ;) 2005-07-23 17:20:05 Reply

It's pretty and all Ing. Couldn't get it to do much else unfortunately (my grasp of AS is strictly in the fundamentals and the intermediates at the moment), although I did get it to spawn from a random position every time a firework finished detonating from a random x position, from a fixed spot on the y axis. Nothing impressive of course, and couldn't work out multiple fireworks from the same system.


...

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:21:35 Reply

http://img328.images..age=untitled67jv.swf

here is teh demo

Denvish
Denvish
  • Member since: Apr. 25, 2003
  • Offline.
Forum Stats
Member
Level 46
Blank Slate
Response to AS: FireWorks ;) 2005-07-23 17:59:13 Reply

I actually posted a fireworks script in the API thread while ago... it doesn't have the rocket, but the particles are more sparkly =)
Copy/paste job:

Quick firework-style script. Click background to generate.

//Recommend 20 to 25 FPS
gravity=30;
numsparks=100;
sparksize=2;

SW=Stage.width; SH=Stage.height; f=100;
C1=new Array("0xFF0000", "0xFFFFFF", "0xFFFF00", "0xFF9900", "0xFFCC33", "0xFFFFFF")

function makespark(rd){
_root.createEmptyMovieClip("spark", -7000);
with(spark){
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*1.5, 0, 0, rd);
curveTo(-rd*1.5, 0, 0, -rd);
endFill();
_visible=0;
}
}

function makeback(){
_root.createEmptyMovieClip("back", 1);
with(back){
beginFill(0x000000, 100);
moveTo(0, 0);
lineTo(SW, 0);
lineTo(SW, SH);
lineTo(0, SH);
lineTo(0, 0);
endFill();
}

back.onPress=function(){
f+= numsparks+10;
for(z=f; z<(f+numsparks); z++){
duplicateMovieClip("spark", "spark"+z, z)
with(_root["spark"+z]){
_x=_root._xmouse;
_y=_root._ymouse;
}
_root["spark"+z].vx= ((random(400)-200)/35);
_root["spark"+z].vy= ((random(200)-150)/35);

_root["spark"+z].onEnterFrame=function(){
new Color(this).setRGB(C1[random(C1.length)]);
this._x+=this.vx*0.6;
this._y+=this.vy*1;
this._alpha-=1;
down=random(gravity)/100;
this.vy+=down;
if(this._y>SH || this._alpha<0){
this.removeMovieClip();
}
}
}
}
}

makeback()
makespark(sparksize)

RESULT


- - Flash - Music - Images - -

BBS Signature
Glaiel-Gamer
Glaiel-Gamer
  • Member since: Dec. 28, 2004
  • Offline.
Forum Stats
Member
Level 28
Game Developer
Response to AS: FireWorks ;) 2005-07-23 18:24:22 Reply

I like denvish's better, but it's just that it's a bit too square.

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 08:21:07 Reply

At 7/23/05 05:59 PM, Denvish wrote:
Quick firework-style script. Click background to generate.

yeah, I've already seen this (in your new game)... still very nice sparkewise... I still think the fireworks in shoot for the sky pwn us.

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 08:35:34 Reply

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
trace(ref._x+","+ref._y+","+ref);
}
function explode(ref) {
for (i=0; i<40; i++) {
ref["boom"+i].delay = 11;
ref["boom"+i]._rotation = random(30)-15;
ref["boom"+i]._x+=random(50)-25;
ref["boom"+i]._y-=random(50)-25;
ref._rotation=0;
rot = ref["boom"+i]._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref["boom"+i].rot = rot;
ref["boom"+i].onEnterFrame = function() {
this._alpha=random(40)+50+this.delay*3;
if (this.delay>0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x += Math.sin((this.rot/180)*Math.PI)*this.dela
y;
} else if (this.delay<0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x -= Math.sin((this.rot/180)*Math.PI)*this.dela
y/3;
if(this.delay<-20){

removeMovieClip(this._parent);
delete this.onEnterFrame;
}
}
this.delay--;
trace(this._x);
};
}
ref.delay--;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3,0xFFFFFF, 100);
ref["boom"+i]._alpha = i*(100/80) - 20;
ref["boom"+i].onEnterFrame=function(){
this._alpha+=2;
}
ref["boom"+i].moveTo(i, 0);
ref["boom"+i].lineTo(i+1, 1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 25;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
explode(ref);
} else {
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter=_root.counter%6 + 1;
};
Mouse.addListener(b);

white only MOD

Kipling
Kipling
  • Member since: May. 4, 2004
  • Offline.
Forum Stats
Member
Level 13
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 08:38:17 Reply

At 7/23/05 05:19 PM, btriangle wrote: i dont even get it, cause i dont have fireworks but i know what itt does

lol, you obviously don't. It's a script for making fireworks. Not actionscript for Fireworks the programme. Silly kid.

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 08:50:05 Reply

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function explode(ref) {
for (i=0; i<40; i++) {
ref["boom"+i].delay=11;
ref["boom"+i]._rotation = random(30)-15;
ref["boom"+i]._x += random(50)-25;
ref["boom"+i]._y -= random(50)-25;
ref._rotation = 0;
rot = ref["boom"+i]._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref["boom"+i].rot = rot;
ref["boom"+i].onEnterFrame = function() {
this._alpha = random(40)+50+this.delay*3;
if (this.delay>0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x += Math.sin((this.rot/180)*Math.PI)*this.dela
y;
} else if (this.delay<0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
y;
this._x -= Math.sin((this.rot/180)*Math.PI)*this.dela
y/3;
if (this.delay<-20) {
removeMovieClip(this._parent);
delete this.onEnterFrame;
}
}
this.delay--;
};
}

ref.onEnterFrame = function() {
this.createEmptyMovieClip("lol",12);
ref.lol.moveTo(this.boom1._x,this.boom1._y
);
for (i=1; i<39; i++) {
this.lol.lineStyle(.2, random(Math.pow(2,24)), random(50)+50);
this.lol.lineTo(this["boom"+i]._x, this["boom"+i]._y);
}
};
ref.delay--;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, random(Math.pow(2,24)), 100);
ref["boom"+i]._alpha = i*(100/80)-20;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(i, 0);
ref["boom"+i].lineTo(i+1, 1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 25;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
explode(ref);
} else {
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);

worst mod ever :(

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 09:02:31 Reply

Denvish+Inglor = pwn

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, random(Math.pow(2,16))<<16, 100);
ref["boom"+i]._alpha = i*(100/80)-20;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(i, 0);
ref["boom"+i].lineTo(i+1, 1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 25;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
} else {
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);

//Denvish ext Recommend 20 to 25 FPS
gravity=70;
numsparks=90;
sparksize=2;

SW=Stage.width; SH=Stage.height; f=90;
C1=new Array("0xFF0000", "0xFFFFFF", "0xFFFF00", "0xFF9900", "0xFFCC33", "0xFFFFFF")

function makespark(prd){
_root.createEmptyMovieClip("spark", -7000);
with(spark){
rd=prd;
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible=0;
}
}

function fddd(ref){
f+= numsparks+10;
for(z=f; z<(f+numsparks); z++){
duplicateMovieClip("spark", "spark"+z, z)
with(_root["spark"+z]){
_x=ref._x;
_y=ref._y;
}
_root["spark"+z].vx= ((random(400)-200)/25);
_root["spark"+z].vy= ((random(200)-150)/25);

_root["spark"+z].onEnterFrame=function(){
new Color(this).setRGB(C1[random(C1.length)]);
this._x+=this.vx*0.6;
this._y+=this.vy*1;
this._alpha-=1;
down=random(gravity)/100;
this.vy+=down;
if(this._y>SH || this._alpha<0){
this.removeMovieClip();
}
}
}
}
makespark(sparksize)

DBarbarian
DBarbarian
  • Member since: Jul. 22, 2003
  • Offline.
Forum Stats
Member
Level 06
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 11:25:49 Reply

Here you go.
I would still not recommend doing everything in AS. It is way too slow.

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}

function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, random(Math.pow(2, 16)) << 16, 100);
ref["boom"+i]._alpha = (100)/i+5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 25;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);

//Denvish ext Recommend 20 to 25 FP
gravity = 1.3;
numsparks = 90;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array() //Particle Array
_root.depth = 10000001;
C1 = new Array("0xFF0000", "0xFFFFFF", "0xFFFF00", "0xFF9900", "0xFFCC33", "0xFFFFFF");

function fddd(ref) {
f += numsparks+10;

_root.createEmptyMovieClip("sparkContainer
"+_root.depth,_root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;

cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}

for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc; //_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]); //ads it to the particle array
}
}

_root.createEmptyMovieClip("enterFrameList
ner",1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {

var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i,1); //remove it from the array
}

var container = n.cont;

i--;
}
container._y+=_root.gravity;
for(qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
}

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 11:43:36 Reply

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function explode(ref) {
for (i=0; i<40; i++) {
ref["boom"+i].delay = 11;
ref["boom"+i]._rotation = random(30)-15;
ref["boom"+i]._x += random(50)-25;
ref["boom"+i]._y -= random(50)-25;
ref._rotation = 0;
rot = ref["boom"+i]._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref["boom"+i].rot = rot;
ref["boom"+i].onEnterFrame = function() {
this._alpha = random(40)+50+this.delay*3;
if (this.delay>0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
;
y;
this._x += Math.sin((this.rot/180)*Math.PI)*this.dela
;
y;
} else if (this.delay<0) {
this._y -= Math.cos((this.rot/180)*Math.PI)*this.dela
;
y;
this._x -= Math.sin((this.rot/180)*Math.PI)*this.dela
;
y/3;
if (this.delay<-20) {
removeMovieClip(this._parent);
delete this.onEnterFrame;
}
}
this.delay--;
};
}
ref.delay--;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, random(Math.pow(2, 24)), 100);
ref["boom"+i]._alpha = i*(100/40);
ref["boom"+i].moveTo(i, 0);
ref["boom"+i].lineTo(i+1, 1);
}
ref._y = 400;
ref._x = _root._xmouse;
ref.delay = random(15)+15;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
explode(ref);
} else {
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);

Meh.


Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 11:49:29 Reply

function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}

function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFFFFFF, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = 25;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);

//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array() //Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFFFFF","0xAAAAAA","0x555555");

function fddd(ref) {
f += numsparks+10;

_root.createEmptyMovieClip("sparkContainer
"+_root.depth,_root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;

cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}

for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc; //_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]); //ads it to the particle array
}
}

_root.createEmptyMovieClip("enterFrameList
ner",1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {

var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i,1); //remove it from the array
}

var container = n.cont;

i--;
}
container._y+=_root.gravity;
for(qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
}

black&white mod, improved cracker too

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 11:51:19 Reply

At 7/24/05 11:43 AM, -liam- wrote: Meh.

you just randomized the length, and the particles don't drop down now.

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 12:01:46 Reply

At 7/24/05 11:51 AM, Inglor wrote: you just randomized the length, and the particles don't drop down now.

Random length is good.

_quality="medium"
function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFFFFFF, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = _root._ymouse;
ref._x = _root._xmouse;
ref.delay = random(15)+15;
ref._rotation = 250+random(40);
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);
//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array();
//Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFFFFF", "0xAAAAAA", "0x555555");
function fddd(ref) {
f += numsparks+10;
_root.createEmptyMovieClip("sparkContainer
"+_root.depth, _root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;
cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFFFFF, 0);
beginFill(0xFFFFFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}
for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc;
//_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]);
//ads it to the particle array
}
}
_root.createEmptyMovieClip("enterFrameList
ner", 1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {
var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i, 1);
//remove it from the array
}
var container = n.cont;
i--;
}
container._y += _root.gravity;
for (qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
};


Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 12:06:54 Reply

if you're gonna make it random, make the direction random, not the length.

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 12:40:48 Reply

Ultimate. Firework. Mod.

_quality = "medium";
_root.createEmptyMovieClip("backGround", -10000);
with (backGround) {
lineStyle(1, 0x000000, 0);
beginFill(0x000033, 100);
lineTo(550, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 0);
}
_root.createEmptyMovieClip("ground", -10001);
with (backGround) {
moveTo(0, 360);
beginFill(0x351100, 100);
lineStyle(5, 0x003300, 100);
lineTo(550, 360);
lineStyle(2, 0x000000, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 360);
}
function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFC0361, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = 370;
ref._x = _root._xmouse;
ref.delay = random(15)+15;
ref._rotation = random(180)+180;
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);
//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array();
//Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFCCFF", "0xFF00FF", "0xFF66FF");
function fddd(ref) {
f += numsparks+10;
_root.createEmptyMovieClip("sparkContainer
"+_root.depth, _root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;
cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFCCFF, 0);
beginFill(0xFFCCFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}
for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc;
//_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]);
//ads it to the particle array
}
}
_root.createEmptyMovieClip("enterFrameList
ner", 1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {
var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i, 1);
//remove it from the array
}
var container = n.cont;
i--;
}
container._y += _root.gravity;
for (qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
};


Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:21:02 Reply

Patched :)

_quality = "medium";
shots=0;
_root.createEmptyMovieClip("backGround", -10000);
with (backGround) {
lineStyle(1, 0x000000, 0);
beginFill(0x000033, 100);
lineTo(550, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 0);
}
_root.createTextField("text2", 7088, 20, 10, 490, 150);
_root.text2.type = "static";
_root.text2.setTextFormat(_root.t);
_root.text2.html = true;
_root.text2.htmlText = "<font COLOR='#FFFFFF'>Created by Inglor, Denvish, DBarbarian and Liam</font>";
_root.createTextField("text1", 6088, 20, 30, 490, 150);
_root.createEmptyMovieClip("ground", -10001);
text1.html=true;
text1.htmlText="<font COLOR='#FFFFFF'> Shots: 0";
with (backGround) {
moveTo(0, 360);
beginFill(0x351100, 100);
lineStyle(5, 0x003300, 100);
lineTo(550, 360);
lineStyle(2, 0x000000, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 360);
}
function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFC0361, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = 370;
ref._x = _root._xmouse;
ref.delay = random(5)+20;
ref._rotation = random(90)+235;
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
shots++;
text1.htmlText="<font COLOR='#FFFFFF'> Shots: "+shots;
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);
//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array();
//Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFCCFF", "0xFF00FF", "0x9900FF");
function fddd(ref) {
f += numsparks+10;
_root.createEmptyMovieClip("sparkContainer
"+_root.depth, _root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;
cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFCCFF, 0);
beginFill(0xFFCCFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}
for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc;
//_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]);
//ads it to the particle array
}
}
_root.createEmptyMovieClip("enterFrameList
ner", 1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {
var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i, 1);
//remove it from the array
}
var container = n.cont;
i--;
}
container._y += _root.gravity;
for (qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
};

I'm gonna add a BG now

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:34:55 Reply

At 7/24/05 01:21 PM, Inglor wrote: I'm gonna add a BG now

Schweet.

Add these two lines somewhere though;

_root.text2.selectable = false;
text1.selectable = false;

So that annoying line thing doesn't appear :)

I didn't even know you could do selectable=false.. god I learn something new every day.

Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:42:06 Reply

Modded to perfection :D

_quality = "medium";
shots = 0;
function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
mc.moveTo(x+r, y);
mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}
trace(bgHeights);
delete bgHeights;
_root.createEmptyMovieClip("backGround", -10000);
_root.createEmptyMovieClip("moon",-4000);
moon.beginFill(0xFFFFFF,90);
drawCircle(moon,450,40,26);
moon.endFill();
with (backGround) {
lineStyle(1, 0x000000, 0);
beginFill(0x000033, 100);
lineTo(550, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 0);
bgHeights = new Array();
bgHeights.push(260);
for (d=0; d<11; d++) {
t = bgHeights[bgHeights.length-1];
t += random(50)-25;
if (t>360) {
t = 360;
}
bgHeights.push(t);
}
endFill();
beginFill(0x2F3528,100);
moveTo(0, bgHeights[1]);
lineStyle(4, 0xAAAAAA, 0);
for (i=0; i<bgHeights.length; i++) {
lineTo(i*55-55, bgHeights[i]);
}
lineTo(550,400);
lineTo(0,400);
endFill();
}
_root.createTextField("text2", 7088, 20, 10, 490, 50);
_root.text2.type = "static";
_root.text2.setTextFormat(_root.t);
_root.text2.html = true;
_root.text2.htmlText = "<font COLOR='#FFFFFF'>Created by Inglor, Denvish, DBarbarian and Liam</font>";
_root.createTextField("text1", 6088, 20, 30, 490, 50);
_root.createEmptyMovieClip("ground", -10001);
text1.html = true;
text1.htmlText = "<font COLOR='#FFFFFF'> Shots: 0";
with (backGround) {
moveTo(0, 360);
beginFill(0x351100, 100);
lineStyle(5, 0x003300, 100);
lineTo(550, 360);
lineStyle(2, 0x000000, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 360);
}
function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFC0361, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = 370;
ref._x = _root._xmouse;
ref.delay = random(5)+20;
ref._rotation = random(90)+235;
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
shots++;
text1.htmlText = "<font COLOR='#FFFFFF'> Shots: "+shots;
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);
//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array();
//Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFCCFF", "0xFF00FF", "0x9900FF");
function fddd(ref) {
f += numsparks+10;
_root.createEmptyMovieClip("sparkContainer
"+_root.depth, _root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;
cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFCCFF, 0);
beginFill(0xFFCCFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}
for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc;
//_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]);
//ads it to the particle array
}
}
_root.createEmptyMovieClip("enterFrameList
ner", 1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {
var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i, 1);
//remove it from the array
}
var container = n.cont;
i--;
}
container._y += _root.gravity;
for (qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
};

Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:44:06 Reply

http://img285.images..age=untitled69rs.swf

here is the demo, I left it as a link because I found the title "untitled69res" funny.

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:50:31 Reply

At 7/24/05 01:44 PM, Inglor wrote: here is the demo, I left it as a link because I found the title "untitled69res" funny.

_quality = "medium";
shots = 0;
function drawCircle(mc:MovieClip, x:Number, y:Number, r:Number):Void {
mc.moveTo(x+r, y);
mc.curveTo(r+x, Math.tan(Math.PI/8)*r+y, Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, r+y, x, r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, r+y, -Math.sin(Math.PI/4)*r+x, Math.sin(Math.PI/4)*r+y);
mc.curveTo(-r+x, Math.tan(Math.PI/8)*r+y, -r+x, y);
mc.curveTo(-r+x, -Math.tan(Math.PI/8)*r+y, -Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(-Math.tan(Math.PI/8)*r+x, -r+y, x, -r+y);
mc.curveTo(Math.tan(Math.PI/8)*r+x, -r+y, Math.sin(Math.PI/4)*r+x, -Math.sin(Math.PI/4)*r+y);
mc.curveTo(r+x, -Math.tan(Math.PI/8)*r+y, r+x, y);
}
delete bgHeights;
_root.createEmptyMovieClip("backGround", -10000);
_root.createEmptyMovieClip("moon", -4000);
moon.beginFill(0xFFFFFF, 90);
drawCircle(moon, 450, 40, 26);
moon.endFill();
with (backGround) {
lineStyle(1, 0x000000, 0);
beginFill(0x000033, 100);
lineTo(550, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 0);
bgHeights = new Array();
bgHeights.push(260);
for (d=0; d<11; d++) {
t = bgHeights[bgHeights.length-1];
t += random(50)-25;
if (t>360) {
t = 360;
}
bgHeights.push(t);
}
endFill();
beginFill(0x2F3528, 100);
moveTo(0, bgHeights[1]);
lineStyle(4, 0xAAAAAA, 0);
for (i=0; i<bgHeights.length; i++) {
lineTo(i*55-55, bgHeights[i]);
}
lineTo(550, 400);
lineTo(0, 400);
endFill();
}
_root.createTextField("text2", 7088, 20, 10, 490, 50);
_root.text2.type = "static";
_root.text2.setTextFormat(_root.t);
_root.text2.html = true;
_root.text2.htmlText = "<font COLOR='#FFFFFF'>Created by Inglor, Denvish, DBarbarian and Liam</font>";
_root.createTextField("text1", 6088, 20, 30, 490, 50);
_root.createEmptyMovieClip("ground", -10001);
text1.html = true;
text1.htmlText = "<font COLOR='#FFFFFF'> Shots: 0";
_root.text2.selectable = false;
text1.selectable = false;
with (backGround) {
moveTo(0, 360);
beginFill(0x351100, 100);
lineStyle(5, 0x003300, 100);
lineTo(550, 360);
lineStyle(2, 0x000000, 0);
lineTo(550, 400);
lineTo(0, 400);
lineTo(0, 360);
}
function phase1(ref) {
ref.delay--;
rot = ref._rotation;
if ((rot<0) && (rot>-180)) {
rot *= -1;
} else if (rot>0) {
rot = 180-rot;
rot += 180;
}
ref._y -= Math.sin((rot/180)*Math.PI)*ref.delay;
ref._x += Math.cos((rot/180)*Math.PI)*ref.delay;
}
function generate(ref) {
for (i=0; i<40; i++) {
ref.createEmptyMovieClip("boom"+i, i*2);
ref["boom"+i].lineStyle(3, 0xFC0361, 100);
ref["boom"+i]._alpha = (100)/i-5;
ref["boom"+i].onEnterFrame = function() {
this._alpha += 2;
};
ref["boom"+i].moveTo(-i, 0);
ref["boom"+i].lineTo(-i-1, -1);
}
ref._y = 370;
ref._x = _root._xmouse;
ref.delay = random(5)+20;
ref._rotation = random(90)+235;
ref.onEnterFrame = function() {
if (ref.delay>7) {
phase1(ref);
} else if (ref.delay == 7) {
//explode(ref);
fddd(ref);
removeMovieClip(ref);
delete ref.onEnterFrame;
}
};
}
_root.counter = 0;
b = new Object();
b.onMouseDown = function() {
shots++;
text1.htmlText = "<font COLOR='#FFFFFF'> Shots: "+shots;
_root.createEmptyMovieClip("a"+_root.count
er, _root.counter);
generate(_root["a"+_root.counter]);
_root.counter = _root.counter%6+1;
};
Mouse.addListener(b);
//Denvish ext Recommend 20 to 25 FP
gravity = 1.4;
numsparks = 120;
sparksize = 2;
SW = Stage.width;
SH = Stage.height;
f = 90;
_root.rc = Math.PI/180;
_root.pa = new Array();
//Particle Array
_root.depth = 10000001;
C1 = new Array("0xFFCCFF", "0xFF00FF", "0x9900FF");
function fddd(ref) {
f += numsparks+10;
_root.createEmptyMovieClip("sparkContainer
"+_root.depth, _root.depth);
var cont = _root["sparkContainer"+_root.depth];
_root.depth++;
cont.createEmptyMovieClip("spark", -7000);
with (cont.spark) {
rd = _root.sparksize;
lineStyle(0, 0xFFCCFF, 0);
beginFill(0xFFCCFF);
moveTo(0, -rd);
curveTo(rd*2.5, 0, 0, rd);
curveTo(-rd*2.5, 0, 0, -rd);
endFill();
_visible = 0;
}
for (z=f; z<(f+numsparks); z++) {
cont.spark.duplicateMovieClip("spark"+z, z);
with (cont["spark"+z]) {
_x = ref._x;
_y = ref._y;
}
var r = random(100)+10;
var rot = random(360)*_root.rc;
//_root.rc = Math.PI/180
cont["spark"+z].dx = ref._x+r*Math.cos(rot);
cont["spark"+z].dy = ref._y+r*Math.sin(rot);
cont["spark"+z].cont = cont;
_root.pa.push(cont["spark"+z]);
//ads it to the particle array
}
}
_root.createEmptyMovieClip("enterFrameList
ner", 1000000);
_root.enterFrameListner.onEnterFrame = function() {
if (_root.pa.length>0) {
var i = _root.pa.length-1;
while (i>=0) {
var n = _root.pa[i];
new Color(n).setRGB(C1[random(C1.length)]);
n._x += (n.dx-n._x)/12;
n._y += (n.dy-n._y)/12;
n._xscale -= 2;
n._yscale = n._xscale;
if (n._y>SH || n._xscale<0) {
n.removeMovieClip();
_root.pa.splice(i, 1);
//remove it from the array
}
var container = n.cont;
i--;
}
container._y += _root.gravity;
for (qwe in container) {
container.count++;
}
if (container.count == undefined) {
container.removeMovieClip();
}
}
};

Just changed the text thingie.. anyway, I think that would good with a starry background.. then submitted as an alt. Hmm.

http://img337.images..age=fireworks7sj.swf


Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:54:33 Reply

sure, just add some content, like you have to shoot fireworks at falling objects, that would be cool, an actual API game, don't forget to coauth my alt! (denvish's alt too if he is interested)

add the background, the falling objects you shoot, a score box, and it'll be a pretty nice game :)

if you submit remmember saying it's api

liam
liam
  • Member since: Dec. 11, 2004
  • Offline.
Forum Stats
Member
Level 22
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 13:57:53 Reply

At 7/24/05 01:54 PM, Inglor wrote: add the background, the falling objects you shoot, a score box, and it'll be a pretty nice game :)

I will do.

if you submit remmember saying it's api

Yah, or else people will probably blam because of the file size.


Sup, bitches :)

BBS Signature
Inglor
Inglor
  • Member since: Jan. 26, 2003
  • Offline.
Forum Stats
Member
Level 17
Blank Slate
Response to AS: FireWorks ;) 2005-07-24 14:06:53 Reply

cool, if you need any shorties scripted about this feel free to ask