# Hit-test score as a percentage help

**URL:** <https://forum.kirupa.com/t/hit-test-score-as-a-percentage-help/299179>\
**Category:** Uncategorized\
**Created:** [October 31, 2009, 5:31am UTC](https://forum.kirupa.com/t/hit-test-score-as-a-percentage-help/299179 "2009-10-31T05:31:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![spellbound55](https://avatars.discourse-cdn.com/v4/letter/s/779978/32.png) [@spellbound55](https://forum.kirupa.com/u/spellbound55)\
**Post date:** [October 31, 2009, 5:31am UTC](https://forum.kirupa.com/t/hit-test-score-as-a-percentage-help/299179/1 "2009-10-31T05:31:56Z")

</div>

Hi, I’m making a platform game called Kit Run. Th objective in each level is to gather 100 points in hidden pickups. I want to have the score read as a percentage - when you start the score says 0%, as you collect, depending on the worth of the item, it goes up by such and such %.

How I am attempting to do it:

on the stage I have three dynamic text boxes. one “pointsEarned”, one “PointsTotal”, and one “scoreText”.

The actionscript on the stage is:

pointsEarned = 0  
pointsTotal = 100  
getPercent = pointsEarned/pointsTotal  
scoreText.text = Math.round(getPercent\*100)+"%"

The actionscript on the pickup (a chicken) is this:

onClipEvent (enterFrame) {  
if (this.hitTest(\_root.spritemain)) {  
pointsEarned += 25;  
this.gotoAndPlay(15);  
}  
}

alas it doesnt work. The score stays forever at 0%, even though when I hit the chicken mc it unloads properly. Help please??!! I’ve been writing and rewriting it for HOURS and I cant figure it out.

Thank you!
