# Problem with collision

**URL:** <https://forum.kirupa.com/t/problem-with-collision/120749>\
**Category:** Uncategorized\
**Created:** [August 27, 2004, 2:19am UTC](https://forum.kirupa.com/t/problem-with-collision/120749 "2004-08-27T02:19:43Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![acor](https://avatars.discourse-cdn.com/v4/letter/a/e19b73/32.png) [@acor](https://forum.kirupa.com/u/acor)\
**Post date:** [August 27, 2004, 2:19am UTC](https://forum.kirupa.com/t/problem-with-collision/120749/1 "2004-08-27T02:19:43Z")

</div>

I seem to be having a problem with the “hittest” function. My character will go straight through any object I put infront of it.

Heres the code for “characterf”:

_onClipEvent (load) {_  
_moveSpeed = 5;_  
_}_  
_onClipEvent (enterFrame) {_  
_if (Key.isDown (Key.RIGHT)) {_  
_this.\_x += moveSpeed; \_rotation = 0_  
_} else if (Key.isDown (Key.UP)) {_  
\*this.\_y -= moveSpeed; \_rotation = 270 \*  
_} else if (Key.isDown (Key.DOWN)) {_  
_this.\_y += moveSpeed; \_rotation = 90_  
_} else if (Key.isDown (Key.LEFT)) {_  
_this.\_x -= moveSpeed; \_rotation = 180_  
_}_  
_}_

Heres the code for “wall1”:

_onClipEvent (load) {_  
_if(\_root.characterf.hitTest(this)){_  
_characterf.\_x -= 5;_  
_}_  
_}_

I would post the fla but i dont know how. And does anyone know how to invert a movie clip along the X axis on a key hit? I would prefer “characterf” to:

_else if (Key.isDown (Key.LEFT)) {_  
_this.\_x -= moveSpeed; \_rotation =_ **X\_INVERT**  
\*} \*or something…
