-
[F8] Random Plasement
Hey
Can anyone help ... im trying to get movie clips to load in random postions within another movie clip , im using it together with some coding thatll load photos randomly from a selection of photos.
the overall effect is that images are selected by random then place on the stage at random x and y positions
Anyone gt any ideas on the random placement
Cheers in advance for help
-
Hey Timmy!!!
Howdy, for random placement, you'd want to use Math.random
MC._x = Math.floor(Math.random()* 500);
MC._y = Math.floor(Math.random()*300);
This will put a movieclip anywhere on the x axis between 0 and 500 and the y axis between 0 and 300
-
cheers thnaks for that so simple . similar to the random number generator
thanks again
-
Hey Timmy!!!
Yep, thats all random really is.
-
Just wondering ive come across a slight glitch how do i limit the randomness for example lets say i only want x to be random between 100 and 300 therefore no postions like x=90 or x=310 .
Thanks again for any help
-
Hey Timmy!!!
Howdy, you'd need to add a few numbers to formula that we already have.
MC._x = Math.round(Math.random()*(300-99))+99
this way the numbers will be from 100 to 300 randomly
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
|