-
Spacing by interval and slope
I'm working on this project: http://www.typhoonent.com/dragonrocketpanic.html The problem if you look at the example, is spacing the circles. I need to figure out how to space the evenly. Any good ideas on how to proceed would be very appreciated.
-
Senior Member
-
http://www.typhoonent.com/dragonfirepanic.html Yeah I've been doing some work on it. I got a partly working system down but if I have too many circles it messes up.
-
Senior Member
What if you place all the circles in a grid formation, but afterwards apply a random x/y offset to each one. That way you could control more how evenly distributed they all are
-
The thing is I would like to evenly space them out. Plus the spacing keeps changing. I guess that I just don't see what you are aiming at.
-
Flashmatics
your link is dead...did u sort the problem out?
-
lol sorry, I just did some moving around. I did find a solution, but it still has problems. I can't have it do too many and when it's returning it comes back a little crooked. the link is www.typhoonent.com/dfp/dragonfirepanic.html the code I'm using is this:
code: var intervalx:Number = arm._x+dist*Math.sin(mAngle/180*Math.PI);
var intervaly:Number = arm._y-dist*Math.cos(mAngle/180*Math.PI);
var pointA:Array = new Array(hand._x, hand._y);
for (i=0; i<Math.ceil(nCircles/2); i++) {
if (i+1 != Math.ceil(nCircles/2)) {
intervalx = (pointA[0]+intervalx)/2;
intervaly = (pointA[1]+intervaly)/2;
} else {
intervalx = (intervalx-pointA[0])/2;
intervaly = (intervaly-pointA[1])/2;
}
}
for (i=0; i<nCircles*2-2; i++) {
drawCircles((hand._x+intervalx/2)+intervalx*i,(hand._y+intervaly/2)+intervaly*i,i+1);
}
-
Senior Member
 Originally Posted by swak
The thing is I would like to evenly space them out. Plus the spacing keeps changing. I guess that I just don't see what you are aiming at.
I mean, you can initially place all the circles in an even distance from eachother on the screen:
Code:
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
* * * * * *
And then loop over each circle and move its x and y positions by a random amount (scaled by the randomness you want)
so you'd end up with a formation similar to the grid, except they won't be aligned, and look more randomly positioned
Edit: There's a great article about just this: spacing things out evenly, in Game Developer magazine from a few months ago... if you are subscribed
Last edited by ozmic66; 08-30-2007 at 01:02 PM.
-
I want them spaced evenly though.
Thanks for your help everyone.
-
there is something wrong...
when your hand is pulling back, it is not straight, a bit to the left
then just make a temporary invisible larger movie clip.
when you regenerate your ball, put the larger MC at the same position (the center position)
hit test it with other balls, if it hits, then erase it, move it, and just keep repeating until it found an empty space far enough from the rest of the ball. then remove the the test MC from the stage, to be used later with other new balls.
-
hmm I noticed that problem. The balls that keep randomly being placed are just for testing. Just to make sure we're all on the same page this is for the circles that are between the hand and the arm. I've been working on a map editor so this has taken a bit of the back stage for now but once I get the editor working then I'll get back on the game. If any of you are curious my map editor is here: www.typhoonent.com/dfp/mapeditor.html On a different note. In the map editor I have the comboBox component. The problem is when I try to swap depths like two times with it, the drop down animation stops working for no apparent reason.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|