Heres what i wanna do, i wanna make a qrid of a altrable size, then place a set number of objects onto the grid.
To do this i made a block 20 * 20 (same size as the squares on my grid) at 0,0 then i set the x pos to Random(gridwidth)*20 and same for the y pos. Then i created another object over top of the test block, then repositioned the test block and did the same again.
I told it to do it until the amount of objects reached a set amount. Sadly the objects sometimes overlapped so you couldnt actually see the amount of objects i should be able to see.
So i then added a line that deleted them if they were overlapping.
Sometimes it took almost forever to make the objects because it spent so long deleting em and making em again.
Someone has to know a better way to do this, perhaps using a array???
But that's not random, i thought he wanted it to be random,
i don't know what you exactly want,
but can't you move x or y 20 pixels, if the blocks
are overlapping.
Should for a block, but multiple block in a click-product, might not understand it.
jenswa.neocities.org
Assault Andy Administrator
I make other people create vaporware
Registered 29/07/2002
Points 5686
19th August, 2003 at 05:15:54 -
You should use an array for this, then if there is nothing in a certain slot, allow something to be created there.
OK, i got this to work kinda, i used fastloops to create a object in every square (In the same way i create the grid) Then i select them at random and delete them until their is only a set number left.
The whole thing takes about 2 seconds to draw. Would be better if i could make it faster but still... this does the job.