# Collision Detection

**URL:** <https://forum.kirupa.com/t/collision-detection/25022>\
**Category:** flash\
**Created:** [July 8, 2003, 5:32pm UTC](https://forum.kirupa.com/t/collision-detection/25022 "2003-07-08T17:32:34Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![FatoftheMan](https://avatars.discourse-cdn.com/v4/letter/f/4af34b/32.png) [@FatoftheMan](https://forum.kirupa.com/u/FatoftheMan)\
**Post date:** [July 8, 2003, 5:32pm UTC](https://forum.kirupa.com/t/collision-detection/25022/1 "2003-07-08T17:32:34Z")

</div>

I am making a lame little game for this internet class I am in… anyway, I need to get it so when a rock hits your character he gets hurt, I have all the Basic ideas and whatnot but when I try to use collision detection as in the tutorial on this site it is ridiculously off, for some reason it seems to think that no matter where he is he is hitting a rock…

I noticed the tutorial was for flash 5, could it make a difference that I am using flash MX?

---

<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 8, 2003, 5:33pm UTC](https://forum.kirupa.com/t/collision-detection/25022/2 "2003-07-08T17:33:21Z")

</div>

Post the fla please

---

<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 8, 2003, 5:36pm UTC](https://forum.kirupa.com/t/collision-detection/25022/3 "2003-07-08T17:36:59Z")

</div>

well, the easiest way would be a hit test. inside of the rock animations i would put:

if (\_root.character.hitTest(this.\_x, this.\_y, true)) {  
health -= #;  
(and if you have an animation for injuies, put in a tell target here)  
}

somewhere else put a thing that says:  
if (health \<= 0) {  
(goto death animation)  
(goto you lose screen)  
}

---

<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 8, 2003, 5:56pm UTC](https://forum.kirupa.com/t/collision-detection/25022/4 "2003-07-08T17:56:44Z")

</div>

I unfortunately cannot host the file, here at the school there are security blocks that prevent me from doing so. I really wish I could cause it is hard for me to really explain what is going on.

---

<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 8, 2003, 6:05pm UTC](https://forum.kirupa.com/t/collision-detection/25022/5 "2003-07-08T18:05:06Z")

</div>

save the file on disk, take it home and post it

---

<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 8, 2003, 8:45pm UTC](https://forum.kirupa.com/t/collision-detection/25022/6 "2003-07-08T20:45:44Z")

</div>

```auto
hitTest(x,y,TRUE)

```
