# Help with scoring code

**URL:** https://forum.kirupa.com/t/help-with-scoring-code/13925
**Category:** flash
**Created:** [February 19, 2003, 9:12pm UTC](https://forum.kirupa.com/t/help-with-scoring-code/13925 "2003-02-19T21:12:41Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![aussy](https://avatars.discourse-cdn.com/v4/letter/a/6bbea6/32.png) [@aussy](https://forum.kirupa.com/u/aussy)
#### Post date: [February 19, 2003, 9:12pm UTC](https://forum.kirupa.com/t/help-with-scoring-code/13925/1 "2003-02-19T21:12:41Z")

</div>

I just downloaded a component for my game. IT’s a keep up teh ball game by rolling over it game. I want it so that the number of times you kept it up till it fell to the ground gets squared and added to teh total score. This is the codes i have (seperated into 4 frames). By the way, I use flahs mx.

–#1–  
g = 80;  
kicked = 0;  
elastic = 0.8;  
score = 0;  
bestscore = 0;  
BallRadius = Ball.\_height/1;

–#2–  
t = Number(t)+.1;  
oldx = x;  
oldy = y;  
x = getProperty(“Ball”, \_x);  
y = getProperty(“Ball”, \_y);  
vy = Number(vy)+Number((g/10));  
x = Number(x)+Number((vx/10));  
y = Number(y)+Number((vy/10));  
if (Number(y)\<Number(BallRadius)) {  
y = BallRadius;  
vx = (vx_elastic);  
vy = -(vy_elastic);  
}  
if (Number(y)\>Number((300-BallRadius))) {  
if (Number(kicked) == 1) {  
kicked = 0;  
if (Number(score)\>Number(bestscore)) {  
bestscore = score;  
…/score/:my\_score = bestscore;  
}  
lastscore = score;  
score = 0;  
}  
y = 300-BallRadius;  
vx = (vx_elastic);  
vy = -(vy_elastic);  
}  
if (Number(x)\<Number(BallRadius)) {  
x = BallRadius;  
vx = -(vx_elastic);  
vy = (vy_elastic);  
}  
if (Number(x)\>Number((400-BallRadius))) {  
x = 400-BallRadius;  
vx = -(vx_elastic);  
vy = (vy_elastic);  
}  
setProperty(“Ball”, \_x, x);  
setProperty(“Ball”, \_y, y);  
setProperty(“Ball”, \_rotation, x);  
setProperty(“Ball”, \_xscale, 25);  
setProperty(“Ball”, \_yscale, 25);

–#3–  
gotoAndPlay(“LoopStart”);

–#4–  
kicked = 1;  
t = Number(t)+.1;  
oldx = x;  
oldy = y;  
x = getProperty(“Ball”, \_x);  
y = getProperty(“Ball”, \_y);  
vx = Number((getProperty(“Ball”, \_x)-getProperty(“mouse”, \_x))_10)+Number(((random(3)/10)-0.15));  
vy = Number(-125)+Number((y-getProperty(“mouse”, \_y)));  
dx = (getProperty(“Ball”, \_x)-getProperty(“mouse”, \_x));  
if (Number(dx)\>0) {  
vy = Number(vy)+Number(dx);  
} else if (Number(dx)\<0) {  
vy = vy-dx;  
}  
if (Number(y)\<Number(BallRadius)) {  
y = BallRadius;  
vx = (vx_elastic);  
vy = -(vy_elastic);  
}  
if (Number(y)\>Number((300-BallRadius))) {  
if (Number(score)\>Number(bestscore)) {  
bestscore = score;  
}  
score = 0;  
y = 300-BallRadius;  
vx = (vx_elastic);  
vy = -(vy_elastic);  
}  
if (Number(x)\<Number(BallRadius)) {  
x = BallRadius;  
vx = -(vx_elastic);  
vy = (vy_elastic);  
}  
if (Number(x)\>Number((400-BallRadius))) {  
x = 400-BallRadius;  
vx = -(vx_elastic);  
vy = (vy\*elastic);  
}  
setProperty(“Ball”, \_x, x);  
setProperty(“Ball”, \_y, y);  
setProperty(“Ball”, \_rotation, x);  
setProperty(“Ball”, \_xscale, 25);  
setProperty(“Ball”, \_yscale, 25);  
gotoAndPlay(“LoopStart”);

If you can help, thansk alot.  
-aussy
