At 10/4/05 10:22 AM, F-13 wrote:
At 10/4/05 05:43 AM, brookman wrote:
sorry for double post. i almost forgot: i made another small engine which generates radom trees a few weeks ago:
http://1234567890.ch/plant.swf
other params:
http://1234567890.ch/plant2.swf
I'd like some proof that you actually did all those things.
I don't know, it just seems weird.
okay, if you ask so kindly, i release the flas. please don't copy it without my permission, but you can ask me of course :D. here:
http://1234567890.ch/plant/plant.fla
http://1234567890.ch/plant/plant2.fla
ok this is no real proofes so i explain how the first one works:
frame 1 contains the global vars. "komisch" means wired in german, because this params create a wired thing - test it! i know, the code is messy and half english half german, but i couldn't change it until now...
vars:
objects: counts the objects in the scene (in the bottom right hand corner is a textfield it goes about to 1000 in the swf 3000) the version is not the same.
max: the maximum objects
streuung: i dindn't know the english word, translation=dispersion this is the range of a random number for the angle the new branches grow of.
speed_min and max: is the speed of the growing branches.
abstand_min and max: is the min and max intervall (random), new branches grow out of the parent branche
verzweigung_min max: means the minimum and maximum bypasses a branche has.
start_noise and noise: this is the bent the branches have at the start and the increase amount while growing
you can mess around with this params and see funny results. but don't det the max var too high!
the green object (part) on the left is the thing the tree/plant is made of (it is copied multiple times->max var and it grows lager to make the branches thicker) it has rounded off corners for branches which grow with a high "noise" (otherwise it looks stupid...)
the actual engine is in a empty movie clip at the bottom (point). it drives along, paints green thingies and creates a branche like this. from time to time (random interval) it copies itselve for bypasses.
the load event creates all the random numbers (with min am max). the enterframe event moves the point around with this fucking essential piece of code:
this._x += Math.cos((richtung*2*Math.PI/360))*speed;
this._y += Math.sin((richtung*2*Math.PI/360))*speed;
insted of richtung you could also write this._rotation. i used this in many other codes/games.
the rest duplicates the part object (and counts). and then it duplicates itself if the counter reaches the randomized intervall. it gives the new point object a new angle.
i hope i cound help you and prove that this is my work!
brookman