How to prevent object from overlapping?

  • adiboy
  • Newbie
  • Newbie
  • adiboy
  • Posts: 14

Post 3+ Months Ago

how to prevent any two objects from overlapping each other each time they are randomly played?



i make them randomly appear using the code below but some of them appear on top of the other.



Quote:


onClipEvent(load) {

_x=Math.floor(Math.random()*271)+120;

_y=Math.floor(Math.random()*265)+120;

}

  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Tchuki
  • Mastermind
  • Mastermind
  • Tchuki
  • Posts: 1774
  • Loc: Edinburgh

Post 3+ Months Ago

Code: [ Select ]
onClipEvent(load) {
_x=Math.floor(Math.random()*271)+120;
_y=Math.floor(Math.random()*265)+120;
}
onClipEvent(enterFrame)
if (_root.image1, hitTest(_root.image2)) {
delete _root.image1;
}
  1. onClipEvent(load) {
  2. _x=Math.floor(Math.random()*271)+120;
  3. _y=Math.floor(Math.random()*265)+120;
  4. }
  5. onClipEvent(enterFrame)
  6. if (_root.image1, hitTest(_root.image2)) {
  7. delete _root.image1;
  8. }


Try something like that.

Post Information

  • Total Posts in this topic: 2 posts
  • Users browsing this forum: No registered users and 13 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.