Dynamic Scores, (I am a noob with dynamics)

Ok so I’ve started another project, a pong game, it’s nearly finished except for the scorecount.

On the ball movieclip:

if (this._x>_root.Pad._x) {
_root.LeftScore += 1;
}
if (this._x<_root.EnPad._x) {
_root.RightScore += 1;
}

So if the ball is behind a paddle give the score to the opposite player. This is onClipEvent (EnterFrame) so it’s doing it every frame.

On the Actions frame:

LeftScore = 0;
RightScore = 0;
stop();

Give it a enterframe

and make the dynamic “scoreboard” a “var” and link em with the other script :slight_smile:

the left dynamic board should have:

 LeftScore

as Variable

and the right

RightScore

That only makes them say ‘a’

ricer that doesn’t explain too much to someone that doesn’t know exactly how to do it, now i think you might be using little line as walls? or not, i wish you would have explained your setup a little better…

frame:


var LeftScore:Number = 0;
var RightScore:Number = 0;
stop();

ball:


on(EnterFrame){

 if (this._x>_root.Pad._x) {
trace("left")
_root.LeftScore++;
};

if (this._x<_root.EnPad._x) {
trace("right")
_root.RightScore ++;
};

}

now the score will increase not sure what your problem exactly was but after that you only wan’t it to add score once so i would make a function that will reset the game if you don’t already have it in your version

Nope, that didn’t seem to do anything for it.

I’ll post the fla

darn, flash 8
could you convert to mx 2004 professional?

Yeah sure, here’s the Flash 7 version

_root.RightScore.text ++;

try that

never said that they were textboxes… and didn’t look at the fla so i guess joppe gets the credit =( [whisper]cries[/whisper]

lol, no Bomb you get all the credit :slight_smile: :wink:

Thx joppe and bomb

better method…
(the code’s prettier)