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 09-05-2003, 04:31 PM   #1
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Smile eye candy Flowers

hmm, there aren't really many JfKCs at the moment, so here is a new one!
Standard rules + max linecount: let's say 35 lines (because the drawing methods take many lines)

I think flowers is a big theme, so everybody might be abled to imagine something.

Theme is whatever you can associate with flowers!
moving blossoms, growing flowers,... whatever
McGiver is offline   Reply With Quote
Old 09-05-2003, 06:09 PM   #2
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Default

Ok, here is my one

ActionScript Code:
//set fps to 24 and background to orange function createflowerblast(i) {     _root.createEmptyMovieClip("flower"+i, i+100);     _root["flower"+i]._x = _xmouse;     _root["flower"+i]._y = _ymouse;     _root["flower"+i].leafs = Math.round(Math.sqrt(Math.random()*80))+3;     _root["flower"+i].leafpoints = Math.round((Math.random()*2+1))*2;     _root["flower"+i][leafpoint+(0)] = -Math.sqrt(Math.random()*100)*3;     for (k=1; k<=_root["flower"+i].leafpoints; k++) {         _root["flower"+i][leafpoint+k] = _root["flower"+i][leafpoint+(k-1)]-Math.sqrt(Math.random()*100)*3+5;         _root["flower"+i].leafsize += _root["flower"+i][leafpoint+k];}     _root["flower"+i].leafcolor = [parseInt(("0x"+(Math.round(Math.random()*239+16)).toString(16)+"ff"+(Math.round(Math.random()*239+16)).toString(16))), parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)))];     for (j=0; j<_root["flower"+i].leafs; j++) {         _root["flower"+i].createEmptyMovieClip("leaf"+j, j+10);         _root["flower"+i]["leaf"+j].lineStyle(1, 0x990000, 50);         _root["flower"+i]["leaf"+j].beginGradientFill("radial", _root["flower"+i].leafcolor, [100, 100], [0, 255], {matrixType:"box", x:(-_root["flower"+i].leafsize)/2-10, y:(-_root["flower"+i].leafsize)/2-10, w:_root["flower"+i].leafsize+20, h:_root["flower"+i].leafsize+20, r:(0/180)*Math.PI});         for (k=1; k<=(_root["flower"+i].leafpoints); k += 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*-15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k+1))*-15, _root["flower"+i][leafpoint+(k+1)]);}         for (k=(_root["flower"+i].leafpoints)-1; k>1; k -= 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k-1))*15, _root["flower"+i][leafpoint+(k-1)]);}         _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], 0, 0);         _root["flower"+i]["leaf"+j].endFill();         _root["flower"+i]["leaf"+j]._rotation = j*(360/_root["flower"+i].leafs);}} function doflowerblast(grow, i) {     _root["flower"+i]._xscale = _root["flower"+i]._yscale=grow;} _root.flowerarr = []; _root.onEnterFrame = function() {     for (n=i-5; n<=i; n++) {         _root["flower"+n].grow += 200000;         doflowerblast(Math.sqrt(Math.sqrt(_root["flower"+n].grow)),n);}}; _root.onMouseMove = function() {     i++;     createflowerblast(i);};
McGiver is offline   Reply With Quote
Old 09-05-2003, 06:46 PM   #3
dzy2566
Deprecated User?
 
dzy2566's Avatar
 
Join Date: Jul 2003
Location: Sherman Oaks, Ca
Posts: 1,086
Send a message via AIM to dzy2566
Default

Well, it's embarassing to submit this after seing McGiver's, but here you go. I went with the basic SIM approach. I know it's boring, but I also only spent about a half hour on it. It was better than what I get paid to do, so

The flower grows on sunny days. If it doesn't get rain for more than 4 days, it dies. There is a 40% chance of rain everyday.

ActionScript Code:
daysWoRain = 0; numDay = 1; _root.createEmptyMovieClip("flower",1); _root.lineStyle(5,0x006600,100); _root.moveTo(0,400); _root.lineTo(550,400); flower.lineStyle(1,0x000000,100); flower.moveTo(5,0); flower.lineTo(5,-100); flower.curveTo(80,-120,65,-165); flower.curveTo(0,-125,-65,-165); flower.curveTo(-120,-145,-5,-100); flower.lineTo(-5,0); flower._x = 275; flower._y = 400; interval = setInterval(updateFlower,3000); function updateFlower(path){     num = Math.random()*10;     numDay++;     if(num >6){         daysWoRain = 0;         typeOfDay = "Rainy :(";     }else{         if(daysWoRain <= 4){             typeOfDay = "Sunny :)"             _root.flower._xscale *= 1.05;             _root.flower._yscale *= 1.1;             daysWoRain++;         }else { killFlower(_root.flower);}}         trace("Day "+numDay+": "+typeOfDay+"      Days w/o rain:"+daysWoRain);         }; function killFlower(path){     path.removeMovieClip();     trace("Your flower has died");     clearInterval(interval);}
I'll be back at a computer by sunday, hopefully people will play with this. If not, I'll try and make it more exciting, when I'm at home not wasting my boss's money.

Last edited by dzy2566; 09-08-2003 at 02:38 PM..
dzy2566 is offline   Reply With Quote
Old 09-05-2003, 07:07 PM   #4
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Default

hmm, it should not be embarassing. I just spend more time on it (about 2 hours)

Note: the flower is always dying, so i think the code was ment to be
num = Math.random()*100
McGiver is offline   Reply With Quote
Old 09-06-2003, 08:34 AM   #5
vulcanpimp
Registered User
 
Join Date: Aug 2003
Posts: 116
Default

nice scripts. has anyone seen a site called something like u-control.com

it was around about two years ago , and showed scripts to make flowers grow. They not only looked good but grew realistically as well.
vulcanpimp is offline   Reply With Quote
Old 09-06-2003, 01:59 PM   #6
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Default

two variations:

more color:
ActionScript Code:
//background=white/orange; fps =24 function createflowerblast(i) {     _root.createEmptyMovieClip("flower"+i, i+100);     _root["flower"+i]._x = _xmouse;     _root["flower"+i]._y = _ymouse;     _root["flower"+i].leafs = Math.round(Math.sqrt(Math.random()*80))+3;     _root["flower"+i].leafpoints = Math.round((Math.random()*2+1))*2;     _root["flower"+i][leafpoint+(0)] = -Math.sqrt(Math.random()*100)*3;     for (k=1; k<=_root["flower"+i].leafpoints; k++) {         _root["flower"+i][leafpoint+k] = _root["flower"+i][leafpoint+(k-1)]-Math.sqrt(Math.random()*100)*3+5;         _root["flower"+i].leafsize += _root["flower"+i][leafpoint+k];}     _root["flower"+i].leafcolor = [parseInt(("0x"+(Math.round(Math.random()*239+16)).toString(16)+"ff"+(Math.round(Math.random()*239+16)).toString(16))), parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16))),parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16))),parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16))),parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16))),parseInt(("0x"+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)+(Math.round(Math.random()*155+100)).toString(16)))];     for (j=0; j<_root["flower"+i].leafs; j++) {         _root["flower"+i].createEmptyMovieClip("leaf"+j, j+10);         _root["flower"+i]["leaf"+j].lineStyle(1, 0x990000, 50);         _root["flower"+i]["leaf"+j].beginGradientFill("radial", _root["flower"+i].leafcolor, [100, 100,100, 100,100, 100], [0,60,100,140,180, 255], {matrixType:"box", x:(-_root["flower"+i].leafsize)/2-10, y:(-_root["flower"+i].leafsize)/2-10, w:_root["flower"+i].leafsize+20, h:_root["flower"+i].leafsize+20, r:(0/180)*Math.PI});         for (k=1; k<=(_root["flower"+i].leafpoints); k += 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*-15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k+1))*-15, _root["flower"+i][leafpoint+(k+1)]);}         for (k=(_root["flower"+i].leafpoints)-1; k>1; k -= 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k-1))*15, _root["flower"+i][leafpoint+(k-1)]);}         _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], 0, 0);         _root["flower"+i]["leaf"+j].endFill();         _root["flower"+i]["leaf"+j]._rotation = j*(360/_root["flower"+i].leafs);}} function doflowerblast(grow, i) {     _root["flower"+i]._xscale = _root["flower"+i]._yscale=grow;} _root.flowerarr = []; _root.onEnterFrame = function() {     for (n=i-5; n<=i; n++) {         _root["flower"+n].grow += 200000;         doflowerblast(Math.sqrt(Math.sqrt(_root["flower"+n].grow)),n);}}; _root.onMouseMove = function() {     i++;     createflowerblast(i);};

I really love this one:
ActionScript Code:
//background=white; fps =24 function createflowerblast(i) {     _root.createEmptyMovieClip("flower"+i, i+100);     _root["flower"+i]._x = _xmouse;     _root["flower"+i]._y = _ymouse;     _root["flower"+i].leafs = Math.round(Math.sqrt(Math.random()*80))+3;     _root["flower"+i].leafpoints = Math.round((Math.random()*2+1))*2;     _root["flower"+i][leafpoint+(0)] = -Math.sqrt(Math.random()*100)*3;     for (k=1; k<=_root["flower"+i].leafpoints; k++) {         _root["flower"+i][leafpoint+k] = _root["flower"+i][leafpoint+(k-1)]-Math.sqrt(Math.random()*100)*3+5;         _root["flower"+i].leafsize += _root["flower"+i][leafpoint+k];}     for (j=0; j<_root["flower"+i].leafs; j++) {         _root["flower"+i].createEmptyMovieClip("leaf"+j, j+10);         _root["flower"+i]["leaf"+j].lineStyle(1, 0x990000, 50);         _root["flower"+i]["leaf"+j].beginFill(0xffffff,50)         for (k=1; k<=(_root["flower"+i].leafpoints); k += 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*-15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k+1))*-15, _root["flower"+i][leafpoint+(k+1)]);}         for (k=(_root["flower"+i].leafpoints)-1; k>1; k -= 2) {             _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], Math.sqrt(_root["flower"+i].leafpoints-(k-1))*15, _root["flower"+i][leafpoint+(k-1)]);}         _root["flower"+i]["leaf"+j].curveTo(Math.sqrt(_root["flower"+i].leafpoints-k)*15, _root["flower"+i][leafpoint+k], 0, 0);         _root["flower"+i]["leaf"+j].endFill()         _root["flower"+i]["leaf"+j]._rotation = j*(360/_root["flower"+i].leafs);}} function doflowerblast(grow, i) {     _root["flower"+i]._xscale = _root["flower"+i]._yscale=grow;} _root.flowerarr = []; _root.onEnterFrame = function() {     for (n=i-5; n<=i; n++) {         _root["flower"+n].grow += 20000000000000;         doflowerblast(Math.sqrt(Math.sqrt(Math.sqrt(_root["flower"+n].grow))),n);}}; _root.onMouseMove = function() {     i++;     createflowerblast(i);};

Last edited by McGiver; 09-06-2003 at 02:08 PM..
McGiver is offline   Reply With Quote
Old 09-06-2003, 02:28 PM   #7
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Default

hmm, tell me if I'm wrong, but is it possible that the interess of most people here is far away from Just for kicks challanges?!
Come on guys (and girls) summer is over! time to get back to the good old PC!
This is no competition! just feel free to post what you created, or create something! Don't care to be better or worse than anyone else! Try to be different, and show us what you imagined to a theme!

@ dzy2566 I like your living plant!

Last edited by McGiver; 09-06-2003 at 02:31 PM..
McGiver is offline   Reply With Quote
Old 09-08-2003, 10:23 AM   #8
dzy2566
Deprecated User?
 
dzy2566's Avatar
 
Join Date: Jul 2003
Location: Sherman Oaks, Ca
Posts: 1,086
Send a message via AIM to dzy2566
Default

Thanks Mc., I'm going to hit it again tonight and see what else I can do with it. I was away camping this weekend so I didn't have tiem to play with it, but it was a blast. Though my fingers are killing me from palying the guitar so much. I'm not sure I can type anymore. Ha. Anyway, I appreciate the encouragement and I'm going to submit another one soon.
dzy2566 is offline   Reply With Quote
Old 09-08-2003, 12:48 PM   #9
vulcanpimp
Registered User
 
Join Date: Aug 2003
Posts: 116
Default

this is my attempt.

its a few lines over but, quite frankly it doesn't bother me.

you can download it here.
http://www.geocities.com/hairybobby2000/fxflower.html

or the codes here

ActionScript Code:
this.createEmptyMovieClip("flame", 2); with (_root.flame) {     matrix = {a:200, b:0, c:0, d:110, e:100, f:0, g:0, h:00, i:1};     beginGradientFill("linear", [0x343ee0, 0x00eeFF], [100, 90], [0, 0xFF], matrix);     for (i=0; i<5; i++) {         curveTo(170*Math.cos((i-140)*72*0.0175), 170*Math.sin((i-140)*72*0.0175), 170*Math.cos((i)*72*0.0175), 170*Math.sin((i)*72*0.0175));         curveTo(170*Math.cos((i+170)*72*0.0175), 170*Math.sin((i+170)*72*0.0175), 0, 0);     }     endFill(); } _root.createEmptyMovieClip("stem", 1); flame._xscale = 0; flame._yscale = 0; ht = random(33)+140; wd = random(50)-25; yyy3 = 155; yyy33 = yyy3/20; xxx3 = random(50)-25; xxx33 = xxx3/20; yyy2 = yyy3/2; xxx2 = -xxx3/2; yyy22 = yyy2/20; xxx22 = xxx2/20; stem._x = 200; stem._y = 144; stem.onEnterFrame = function() {     stem.Clear();     stem.lineStyle(flame._xscale/15, 0x2f3342, 100);     xxx22 = xxx22+((xxx2-xxx22)*.02);     yyy22 = yyy22+((yyy2-yyy22)*.02);     xxx33 = xxx33+((xxx3-xxx33)*.02);     yyy33 = yyy33+((yyy3-yyy33)*.02);     stem.moveTo(0, 0);     stem.curveTo(xxx22,-yyy22,xxx33,-yyy33);     flame._x = xxx33+stem._x;     flame._y = -yyy33+stem._y;     flame._rotation = xxx33*5;     flame._xscale = flame._xscale+((100-flame._xscale)*0.015);     flame._yscale = flame._yscale+((100-flame._yscale)*0.015); };

Last edited by Jesse; 09-23-2003 at 06:18 AM..
vulcanpimp is offline   Reply With Quote
Old 09-08-2003, 01:14 PM   #10
McGiver
Goldmember
 
McGiver's Avatar
 
Join Date: Feb 2003
Location: bavaria in germany
Posts: 1,627
Default

yeah, this looks cool!
McGiver 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


All times are GMT. The time now is 01:59 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.