This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#1 2011-02-17 05:40:13

dibbotson
New Scratcher
Registered: 2011-02-17
Posts: 1

Creating a score

Ok, I have created a 2 player simple pong game with a score for each team. When the ball hits opponents dead area your score increases by 1. Now my problem is the game goes on forever.

So as i learned in the simple pong game i can create a sprite which displays game over using a broadcast.

What i want to do is when one teams score reaches 10 or 20 a sprite appears saying that team has won. e.g. green team gets 10 and a sprite appears saying green team wins.

i've been looking at if statements and variables but cant seem to do it. please help.

thanks

Offline

 

#2 2011-02-17 16:51:10

Ratty1967UK
Scratcher
Registered: 2007-05-16
Posts: 88

Re: Creating a score

use the same "game over" technique you've used before but have two costumes on the "game over" sprite - one saying "red team wins" the other says "green team wins" - switch to the correct costume before showing the sprite - simple

Offline

 

#3 2011-02-17 17:13:55

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Creating a score

dibbotson wrote:

Ok, I have created a 2 player simple pong game with a score for each team. When the ball hits opponents dead area your score increases by 1. Now my problem is the game goes on forever.

So as i learned in the simple pong game i can create a sprite which displays game over using a broadcast.

What i want to do is when one teams score reaches 10 or 20 a sprite appears saying that team has won. e.g. green team gets 10 and a sprite appears saying green team wins.

i've been looking at if statements and variables but cant seem to do it. please help.

thanks

<when green flag clicked>
<forever>
    <if><( <{ Player 1 score }> <>> 10 )>
        <broadcast[ Player 1 win

<when I receive[ Player 1 win
<switch to costume[ P1 Wins

And the same for player 2.

Last edited by shadow_7283 (2011-02-17 17:14:10)

Offline

 

#4 2011-02-18 20:27:23

rantg
Scratcher
Registered: 2010-10-16
Posts: 99

Re: Creating a score

[blocks]or you could use a variable for pointshttp://scratch.mit.edu/forums/viewtopic.php?id=56743#req_message[/blocks


http://www.mariowiki.com/images/4/47/JumpBlock_3D.png  yikes  My song request page has passed the 100 post mark!

Offline

 

#5 2011-02-18 21:45:37

shadow_7283
Scratcher
Registered: 2007-11-07
Posts: 1000+

Re: Creating a score

rantg wrote:

[blocks]or you could use a variable for pointshttp://scratch.mit.edu/forums/viewtopic.php?id=56743#req_message[/blocks

That's what he or she is doing...

Offline

 

Board footer