# Collision Problem

**URL:** <https://forum.kirupa.com/t/collision-problem/116985>\
**Category:** Uncategorized\
**Created:** [July 23, 2004, 2:59am UTC](https://forum.kirupa.com/t/collision-problem/116985 "2004-07-23T02:59:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![BallR0507](https://avatars.discourse-cdn.com/v4/letter/b/ac8455/32.png) [@BallR0507](https://forum.kirupa.com/u/BallR0507)\
**Post date:** [July 23, 2004, 2:59am UTC](https://forum.kirupa.com/t/collision-problem/116985/1 "2004-07-23T02:59:49Z")

</div>

does anybody know a way to use the hitTest function but against all Mc’s.if not does anybody know how to use the hitTest in a top view game (Like the original Gta’s)where you can move in 360 degree’s.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [July 23, 2004, 3:38am UTC](https://forum.kirupa.com/t/collision-problem/116985/2 "2004-07-23T03:38:18Z")

</div>

> [@BallR0507](#):
>
> does anybody know a way to use the hitTest function but against all Mc’s.if not does anybody know how to use the hitTest in a top view game (Like the original Gta’s)where you can move in 360 degree’s.

Try this:

```php
 
onClipEvent (load) {
s = 5;
b = this.getBounds(this);
function move(x, y) {
if (!_root.limits.hitTest(_x+x+b.xmin+5, _y+y+b.ymin+5, true)) {
if (!_root.limits.hitTest(_x+x+b.xmax-5, _y+y+b.ymin+5, true)) {
	if (!_root.limits.hitTest(_x+x+b.xmin+5, _y+y+b.ymax-5, true)) {
	 if (!_root.limits.hitTest(_x+x+b.xmax-5, _y+y+b.ymax-5, true)) {
	 _x += x;
	 _y += y;
	 }
	}
}
}
}
}
onClipEvent (enterFrame) { 
if (Key.isDown(Key.UP)) {
move(0, -s);
}
if (Key.isDown(Key.DOWN)) {
move(0, s);
}
if (Key.isDown(Key.RIGHT)) {
move(s, 0);
}
if (Key.isDown(Key.LEFT)) {
move(-s, 0);
}
}

```

Hope that helps. Its not mine, but it was taught to me 😃

P.S. its for da walls. I dont know how to make a hitTest for ALL the mcs.
