I'm using AS 3 and Flash CS 6.
I'm using this code to randomly place movie clips from the library in a container on the stage:
There are actually eight movie clips I am adding to the stage but just pasted the code from two.Code:var container:Sprite = new Sprite(); addChild(container); container.x = 300; container.y = 200; var food:food_mc = new food_mc(); container.addChild(food); food.x = Math.random()*450; food.y = Math.random()*350; var food1:food_mc = new food_mc(); container.addChild(food1); food1.x = Math.random()*450; food1.y = Math.random()*350;
Unfortunately they are overlapping, which isn't what I want.
Is there a way to ensure they don't overlap?
Many thanks.




Reply With Quote
