# To Hittest or Not To Hittest

**URL:** https://forum.kirupa.com/t/to-hittest-or-not-to-hittest/300904
**Category:** programming
**Created:** [November 30, 2009, 9:55am UTC](https://forum.kirupa.com/t/to-hittest-or-not-to-hittest/300904 "2009-11-30T09:55:59Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![mordormaster](https://avatars.discourse-cdn.com/v4/letter/m/b487fb/32.png) [@mordormaster](https://forum.kirupa.com/u/mordormaster)
#### Post date: [November 30, 2009, 9:55am UTC](https://forum.kirupa.com/t/to-hittest-or-not-to-hittest/300904/1 "2009-11-30T09:55:59Z")

</div>

Hittesting has become pretty much the most important part of my game. So ive ended up putting 62 hittests on one of four secsions per enemy. So understandably, lag central, anybody got a more efficant way of doing this code.

onClipEvent (enterFrame) {  
if (\_root.floor.ai1.hitTest (this)) {  
\_root.floor.enemy1.\_y+=15  
}  
if (\_root.floor.ai2.hitTest (this)) {  
\_root.floor.enemy1.\_y+=15  
}  
if (\_root.floor.ai3.hitTest (this)) {  
\_root.floor.enemy1.\_y+=15  
}  
if (\_root.floor.ai4.hitTest (this)) {  
\_root.floor.enemy1.\_y+=15  
}  
if (\_root.floor.ai5.hitTest (this)) {  
\_root.floor.enemy1.\_y+=15  
}  
}
