# Route problem

**URL:** <https://forum.kirupa.com/t/route-problem/99857>\
**Category:** Uncategorized\
**Created:** [January 22, 2004, 11:05pm UTC](https://forum.kirupa.com/t/route-problem/99857 "2004-01-22T23:05:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![El\_Bicho](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@El\_Bicho](https://forum.kirupa.com/u/El_Bicho)\
**Post date:** [January 22, 2004, 11:05pm UTC](https://forum.kirupa.com/t/route-problem/99857/1 "2004-01-22T23:05:44Z")

</div>

Hi, I have 2 MC and I want them to move each time I press them.  
But I need to move them one a a time and not both of them at the same time as happens with this code.

[AS]  
shot = function (x, y) {  
\_x += x;  
\_y += y;  
};  
for (i = 1; i \< 3; i++) {  
eval(“ball” + i).onPress = function() {  
x = Math.floor(-2 + Math.random() \* 4 + 1);  
y = Math.floor(-2 + Math.random() \* 4 + 1);  
this.onEnterFrame = function() {  
shot(x, y);  
};  
};  
}

```auto

I also want that, if one of them collides the other, to stop moving.

Thanks.
```
