PDA

View Full Version : seed growing


crisrola
07-07-2004, 05:19 PM
hi folks !

please friends,

I need help , how I can to make a seed growing , growing until transform in tree ! I don“t know how to assemble it ! please help me !

bye,,,,thank you very much !

sucess !

Retrix
07-07-2004, 11:45 PM
Hey Christiano

What you need to do is to make a movieclip, press ctrl-F8, press movieclip, then enter on frame 1 of the clip your seed, on frame two the next phase and etc etc. YOu can put additional frames for wach phase so that it takes longer to change. But all this is covered at the tutorials at this site, and simple flash books which you can download from kazaa for example.

cya Retrix

tg
07-08-2004, 04:07 PM
go to www.bit-101.com. look thru some of last years experiments. he has many examples of using script to grow many things.
i don't know if his source code is still available for download, maybe, maybe not. but his experiments are available to purchase on cd, and it's well worth it.

pixelwit
07-08-2004, 04:30 PM
var colr = 0x302010;
var startWi = 3;
var minLen = 60;
var maxLen = 100;
var minBuds = 1;
var maxBuds = 4;
var shootFactor = 2;
var spreadFactor = 1.01;
var maxSpread = 20;
var rotRange = 120;
var scaleFactor = .85;
//
//
MovieClip.prototype.drawBranch = function(){
this.createEmptyMovieClip("Box", 1);
var wi = startWi/2;
with(this.Box){
beginFill(colr);
moveTo(-wi, 0);
lineTo(-wi, -1);
lineTo(wi, -1);
lineTo(wi, 0);
lineTo(-wi, 0);
endFill();
}
}
MovieClip.prototype.makeBranch = function(){
var d = ++this.depth;
var bran = this.createEmptyMovieClip("Branch"+d, d);
bran.depth = 1;
bran.buds = minBuds+Math.floor(Math.random()*(maxBuds+1-minBuds));
bran.drawBranch();
bran.lenth = minLen+Math.random()*(maxLen-minLen);
bran._rotation = Math.random()*rotRange-rotRange/2;
bran._xscale = bran._yscale = scaleFactor*100;
bran._y = (d>3) ? -Math.random()*this.lenth : -this.lenth;
bran.onEnterFrame = function(){
with(this){
if(Box._height<lenth){
Box._height += shootFactor;
if(Box._height>lenth){
Box._height = lenth+.1;
sprout();
}
}
Box._xscale *= spreadFactor;
if(Box._width>maxSpread){
Box._width = maxSpread;
onEnterFrame = null;
}
}
}
}
MovieClip.prototype.sprout = function(){
for(var i=0; i<this.buds; i++){
this.makeBranch();
}
}
function stopAll(clip){
for(var i in clip){
if(typeof clip[i] == "movieclip"){
if(clip[i]._parent == clip){
clip[i].onEnterFrame = null;
stopAll(clip[i]);
}
}
}
}
function newTree (){
createEmptyMovieClip("Tree", 10);
Tree._x = 275;
Tree._y = 400;
Tree.depth = 1;
Tree.makeBranch();
Tree.Branch2._rotation = 0;
onMouseDown = function(){
stopAll(tree);
}
}
Key.addListener(this);
onKeyDown = newTree;
onKeyDown();

-PiXELWiT
http://www.pixelwit.com

tg
07-08-2004, 04:32 PM
hehheh or you can have some skilled guru like pixelwit whip it out and show you how to use it.....



what? i'm talkin about the actionscript editor.

nice work pixelwit.

pixelwit
07-08-2004, 04:53 PM
Glad you like it TG. It's something I wanted to try for a while but never got around to it until now. The code's a bit rough and messy but at least it illustrates the point.

-PiXELWiT
http://www.pixelwit.com

tg
07-08-2004, 04:59 PM
The code's a bit rough and messy but at least it illustrates the point.
that codes so well written (as in descriptive and self documenting) that you can see the trees growing just reading the code.
again. nice job.

Flash Gordon
06-23-2006, 04:33 AM
Holy crap dude!

That rocks!
:D