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!