# HitTestObject: one "hit" counting as multiple

**URL:** <https://forum.kirupa.com/t/hittestobject-one-hit-counting-as-multiple/322237>\
**Category:** flash\
**Created:** [May 15, 2011, 8:54pm UTC](https://forum.kirupa.com/t/hittestobject-one-hit-counting-as-multiple/322237 "2011-05-15T20:54:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![designCannon](https://avatars.discourse-cdn.com/v4/letter/d/3ec8ea/32.png) [@designCannon](https://forum.kirupa.com/u/designCannon)\
**Post date:** [May 15, 2011, 8:54pm UTC](https://forum.kirupa.com/t/hittestobject-one-hit-counting-as-multiple/322237/1 "2011-05-15T20:54:41Z")

</div>

I’m having a problem in my side-scrolling game where when each “prey” gets eaten by the character, they are counting multiple times, causing the “score +1” to happen too many times. It’s almost like they are hitting the character a few times before being registered as “hit” and disappearing. Any ideas how to fix this?

```auto
function preyHandler(event:Event)
	{// handler for prey getting eaten
		for (var i:int=0; i<allPrey.length; i++)
		{
			if (event.target.hitTestObject(hitMc))
			{
				//trace ("hit test successful");
				event.target.width = 0;
				event.target.height = 0;
				preyCount++;
				trace("score +1");
				score.text = String(preyCount);
				event.target.removeEventListener(Event.ENTER_FRAME, preyHandler);
			}
		}
	}//end preyHandler

```
