| Home | Tutorials | Forums | Articles | Blogs | Movies | Library | Employment | Press | Buy templates |
|
|
#1 |
|
Member
Join Date: Jan 2002
Location: San Bernardino, CA
Posts: 75
|
I'm trying to create a 2-player trivia game that utilizes a single scoring function. In order to do this for 2 people, I've tried to use a variable 'who', but am still not getting it right. For some reason the 'who' variable is never reassigned, thus giving all the points to player 1. Everything else works okay, except for this. Thanks in advance for any help!
The first script is placed in frame 1 of the main movie, and the second script is placed on an MC residing on frame 2 of the main movie. --------------------------------------------------------------------------- who=1; score1=0; score2=0; newscore1=score1; newscore2=score2; function right(){ if(who==1){ score1 += 10; newscore1 = score1; updateAfterEvent(); _root.homerun.gotoAndPlay(2); } else if(who==2){ score2 += 10; newscore2 = score2; updateAfterEvent(); _root.homerun.gotoAndPlay(2); } } function wrong(){ if(who==1){ score1 -= 10; newscore1 = score1; updateAfterEvent(); _root.homerun.gotoAndPlay(2); } else if(who==2){ score2 -= 10; newscore2 = score2; updateAfterEvent(); _root.strike.gotoAndPlay(2); } } ------------------------------------------------------------------------------ onClipEvent(keyDown) { if(Key.isDown(65)){ who=1; _root.buzz.gotoAndStop(2); _root.whobuzzed.gotoAndPlay("p1"); } else if(Key.isDown(76)){ who=2; _root.buzz.gotoAndStop(3); _root.whobuzzed.gotoAndPlay("p2"); } _root.nextFrame(); } |
|
|
|
|
|
#2 | |
|
flashing vampire
Join Date: Dec 2001
Location: nowhere
Posts: 1,406
|
Quote:
|
|
|
|
|
|
|
|
|
|
#3 |
|
Member
Join Date: Jan 2002
Location: San Bernardino, CA
Posts: 75
|
Thanks, black. I'll give it a shot. ("scratching my head, could it be that simple?")
|
|
|
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|