# Shuffling \_x and \_y positions

**URL:** <https://forum.kirupa.com/t/shuffling--x-and--y-positions/68931>\
**Category:** flash\
**Created:** [October 30, 2004, 10:44am UTC](https://forum.kirupa.com/t/shuffling--x-and--y-positions/68931 "2004-10-30T10:44:59Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NovemberRain](https://avatars.discourse-cdn.com/v4/letter/n/73ab20/32.png) [@NovemberRain](https://forum.kirupa.com/u/NovemberRain)\
**Post date:** [October 30, 2004, 10:44am UTC](https://forum.kirupa.com/t/shuffling--x-and--y-positions/68931/1 "2004-10-30T10:44:59Z")

</div>

Sorry, again I’ve to come back here …

I’ve tried to randomly move the object on the stage. But the position shifting is not working properly. Sometimes the objects overlap with another one. Pls check the attached file

```auto

MCArray = [];
Xarray = [];
XarrayYpos = [];
for (var i = 1; i<5; i++) {
 MCArray.push (_root["clip" add i]);
 Xarray.push (_root["clip" add i]._x);
 XarrayYpos.push (_root["clip" add i]._y);
 
 
}
function shuffle() {
 return Math.round(Math.random());
}
function newGame() {
 Xarray.sort(shuffle);
 
 for (var i = 0; i<5; i++) {
  MCArray*._x = Xarray*;
  MCArray*._y = XarrayYpos*;
 }
}
s.onPress = function() {
 newGame();
};

  

```
