# Game Scoring Problem

**URL:** <https://forum.kirupa.com/t/game-scoring-problem/185087>\
**Category:** Uncategorized\
**Created:** [April 10, 2006, 8:49pm UTC](https://forum.kirupa.com/t/game-scoring-problem/185087 "2006-04-10T20:49:58Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [April 10, 2006, 8:49pm UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/1 "2006-04-10T20:49:58Z")

</div>

[COLOR=black][FONT=Arial]Hi[/FONT][/COLOR]

[COLOR=black][FONT=Arial]Im having troubles developing what I thought would be a simple score formula.[/FONT][/COLOR]

[COLOR=black][FONT=Arial]I found some old game scoring source, but unfortunately it only works with Flash 6. Im currently using Flash 8.[/FONT][/COLOR]

[COLOR=black][FONT=Arial]Looking at the attached .fla I hope you can work out what it is i was trying to achieve. my AS is entirely wrong and is only there to give anyone willing to help an idea of what I wanted it to do. Otherwise, this it also the code:[/FONT][/COLOR]

[COLOR=black][FONT=Arial]

```auto
stop();
p1_mc.onRelease = function() {
 _root.p1Score = _root.p1Score + 10;
};
p2_mc.onRelease = function() {
 _root.p2Score = _root.p2Score + 10;
};
end_mc.onRelease = function() {
 if (p1Score > p2Score) {
  gotoAndStop("p1win");
 else (p1Score < p2Score) {
  gotoAndStop("p2win");
 else (p1Score == p2Score) {
  gotoAndStop("draw");
};

```

[/FONT][/COLOR]

[COLOR=black][FONT=Arial]The counting formula works fine with Flash 6, but the final function to determine who is the winner, loser or if its a draw is completely wrong.[/FONT][/COLOR]

[COLOR=black][FONT=Arial]Can anybody possibly help me please? it’s driving me mad.[/FONT][/COLOR]

[COLOR=black][FONT=Arial]Thanx[/FONT][/COLOR]

* * *

[Threesome mwm](http://www. **** tube.com/categories/1076/mwm/videos/1)

---

<div class="post-metadata">

**Author:** ![flextnet](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@flextnet](https://forum.kirupa.com/u/flextnet)\
**Post date:** [April 10, 2006, 9:08pm UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/2 "2006-04-10T21:08:46Z")

</div>

You need to initialize those variables now- whereas in flash 6 or below (I think), variables were automatically set to 0. So:

\_root.p1Score = 0;  
\_root.p2Score = 0;  
stop();

// rest of the code here

---

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [April 10, 2006, 9:24pm UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/3 "2006-04-10T21:24:33Z")

</div>

That works fine, however the main issue now is the “end\_mc” button.

I need it to calculate the winner, loser, or a draw.

```auto
end_mc.onRelease = function() {
	if (p1Score > p2Score) {
		gotoAndStop("p1win");
	else (p1Score < p2Score) {
		gotoAndStop("p2win");
	else (p1Score == p2Score) {
		gotoAndStop("draw");
};

```

Thanx for the speedy reply.

* * *

[METH REHAB ADVICE](http://www.rehab-forum.com/meth-rehab/)

---

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [April 11, 2006, 12:53am UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/4 "2006-04-11T00:53:19Z")

</div>

I still havent managed to find a solution. Can anybody help please?

* * *

[TUBE \*\*\*\*](http://www. **** tube.com/)

---

<div class="post-metadata">

**Author:** ![dave4lo](https://avatars.discourse-cdn.com/v4/letter/d/43a26b/32.png) [@dave4lo](https://forum.kirupa.com/u/dave4lo)\
**Post date:** [April 11, 2006, 1:35am UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/5 "2006-04-11T01:35:25Z")

</div>

a few things wrong with your code, and your win labels were missing the s.

> \_root.p1Score = 0;  
> \_root.p2Score = 0;  
> stop();  
> p1\_mc.onRelease = function() {  
> \_root.p1Score = \_root.p1Score+10;  
> };  
> p2\_mc.onRelease = function() {  
> \_root.p2Score = \_root.p2Score+10;  
> };  
> end\_mc.onRelease = function() {

```
if (_root.p1Score&gt;_root.p2Score) {
    gotoAndStop("p1wins");
} else if (_root.p1Score&lt;_root.p2Score) {
    gotoAndStop("p2wins");
} else if (_root.p1Score == _root.p2Score) {
    gotoAndStop("draw");
}

```

};

---

<div class="post-metadata">

**Author:** ![Tyg3r](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/tyg3r/32/1341_2.png) [@Tyg3r](https://forum.kirupa.com/u/Tyg3r)\
**Post date:** [April 11, 2006, 1:39am UTC](https://forum.kirupa.com/t/game-scoring-problem/185087/6 "2006-04-11T01:39:24Z")

</div>

horray! Thank you, I was so close too. 🙂

* * *

[OREGON DISPENSARY](http://oregon.dispensaries.org/)
