PDA

View Full Version : need help with score keeping!



chazzyman
December 12th, 2004, 01:06 PM
Im making a fighting game and i'm having trouble making player 1 or player 2's score go up when he hits the other player. I've got 2 players and on player 1 i have this code to make the score go up
onClipEvent (enterFrame) {
if (Key.isDown(83))
{
this.gotoAndStop(5);
if(_root.B1main.b1kick, hitTest(_root.B2main))
{
b1mainScore += 2;
if(b1mainScore >= winningScore)
{
_root.gotoAndStop(3);
}
}
}
}
and then on my control layer i have this code
stop();
b1mainScore = 0;
b2mainScore = 0;
winningScore = 100;
and i have 2 dynamic text boxes 1 with the variable of b1mainScore and the other with b2mainScore. can anyone help me fix the problem so that the score goes up.

Sammo
December 12th, 2004, 01:17 PM
Not completely sure I know what you mean.

But take a look at this, it might help:
http://www.kirupa.com/developer/mx/score.htm

bbwd
December 12th, 2004, 03:35 PM
onClipEvent (enterFrame) {
if (Key.isDown(83))
{
this.gotoAndStop(5);
if(_root.B1main.b1kick, hitTest(_root.B2main))
{
b1mainScore += 2;
if(b1mainScore >= winningScore)
{
_root.gotoAndStop(3);
}
}
}
}

Hi, try this:



onClipEvent (enterFrame) {
if (Key.isDown(83)) {
this.gotoAndStop(5);
}
if(_root.B1main.b1kick, hitTest(_root.B2main)){
b1mainScore += 2;
}
if(b1mainScore >= winningScore){
_root.gotoAndStop(3);
}
}

chazzyman
December 15th, 2004, 12:56 PM
i fixed the problem the code was
if (Key.isDown(83))
{
this.gotoAndStop(5);
if(_root.b1main.b1kick, hitTest(_root.b2main)){
kick1Sound.start(0,1);
_root.b1mainScore +=2;
updateAfterEvent();
}
}
just needed to update after event (took me a week to figure that out lol) you can play the game at http://www.freewebs.com/flash2themax/flashgames.htm/ (http://www.freewebs.com/flash2themax/) the animations aren't good there just stick men :)