sigh…hey guess what that stuff you sleep through in those math classes you don’t want to take may actually come in handy…needless to say I was the one sleeping.
here’s what I’d like to do:
I am creating a ‘word map’ brainstorming chart. Basically you type an idea into a bubble, then click a button that will add a sub-bubble of that brainstormed idea. Example
I’ll need to generate a random X/Y within a set of boundaries (the stage) that is determined by the parent bubble’s X/Y and a maximum buffer X/Y so the bubbles are grouped nicely together.
var bnd_Left = 10;
var bnd_Top = 10;
var bnd_Right = 290;
var bnd_Bottom = 290;
//
var parentBubble = 150;
var buffer = 50;
//
X = Math.floor(Math.random()*(1+bnd_Right-bnd_Left))+bnd_Left;
Y = Math.floor(Math.random()*(1+bnd_Bottom-bnd_Top))+bnd_Top;
So I have my stage boundaries 300x300 stage with a 10 pixel buffer. The original bubble is at 150x150. The example above works, it will give me a random X/Y, but there is no limit of the number generated there is then no organization to it, so I need to limit the X/Y by adding the restrictions of the parentBubble X/Y as the starting point so that the bubbles will radiate out in 50 pixel increments