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

#1 2012-04-01 23:52:12

justdasqueegy1
New Scratcher
Registered: 2012-03-29
Posts: 4

How to make a "Play Again?" feature in a game

I'm new and shared my first game here on SCRATCH: "Classic Pong". I'm trying to improve it, probably by putting in an option to play the game again.  How do I do that?

Here's the link to the game:
www.scratch.mit.edu/projects/justdasqueegy1/2439381/

Offline

 

#2 2012-04-02 00:22:01

laser314
Scratcher
Registered: 2010-07-16
Posts: 100+

Re: How to make a "Play Again?" feature in a game

Unfortunately, there is no way to do that unless you do this:

when clicked
broadcast
startgame
when I receive
startgame
Gamecode here...
When
replaybutton
clicked
put this in the button to replay sprite
broadcast
startgame


http://alpha.scratch.mit.edu/scratchr2/static//images/logo_sm.png 2.0 Alpha Tester!http://i49.tinypic.com/1zckcqb.png

Offline

 

#3 2012-04-02 05:08:29

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: How to make a "Play Again?" feature in a game

It's actually pretty simple: make a sprite by using the fill tool on the entire canvas, and add the text "Click to play again." Then add these scripts:

when clicked
set
ghost
effect to
100
when sprite1 clicked
broadcast
scratch-startclicked

Last edited by Hardmath123 (2012-04-02 05:08:42)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#4 2012-04-02 08:19:36

PullJosh
Scratcher
Registered: 2011-08-01
Posts: 500+

Re: How to make a "Play Again?" feature in a game

Hardmath123 wrote:

It's actually pretty simple: make a sprite by using the fill tool on the entire canvas, and add the text "Click to play again." Then add these scripts:

when clicked
set
ghost
effect to
100
when
sprite1
clicked
broadcast
scratch-startclicked

Yeah.

broadcast
scratch-startclicked

does the same thing as clicking the green flag.


http://www.blocks.scratchr.org/API.php?action=text&string=I'm_on_vacation!&xpos=155&ypos=90&font_size=30&bgimage=http://imageshack.us/a/img339/7215/sspeechsigapiforwords.png

Offline

 

#5 2012-04-02 08:50:48

Mokat
Scratcher
Registered: 2011-12-08
Posts: 1000+

Re: How to make a "Play Again?" feature in a game

When clicked
broadcast
begin
put this on the stage
When I receive
begin
put this on whatever sprites are going to be playing (like the ball)
game code
broadcast
gameover
When I receive
gameover
this goes on the play again sprite
show
when
play again button
clicked
This also goes on the play again sprite
broadcast
begin

Last edited by Mokat (2012-04-02 08:51:47)


http://www.eggcave.com/egg/977371.pnghttp://www.eggcave.com/egg/977376.pnghttp://www.eggcave.com/egg/1005291.pnghttp://www.eggcave.com/egg/996745.png

Offline

 

#6 2012-04-02 14:03:28

ty44
Scratcher
Registered: 2011-02-05
Posts: 57

Re: How to make a "Play Again?" feature in a game

this is how.

when clicked
broadcast
start

when i receive
start
insert your game code here
if
lives
<
1
or whatever
do game over scene
whatever it is
broadcast
replay

when i receive
replay
for the replay button
show
wait until
touching
mouse-pointer
?
and
mouse down?
broadcast
start

and, on a completely unrelated note,
when
quit button
clicked
stop all

hope this helps.
--
when clicked
forever
go to
my projects
click
one of my projects
say
I like these projects!
click
love it
check out more projects!
click this next block:
obsolete!

Last edited by ty44 (2012-04-02 14:10:32)


http://t3ak.roblox.com/07ffa69f8ced34c7220abf1a8008c1d1 Mario Kart OBSESSION!

Offline

 

#7 2012-04-02 22:24:21

justdasqueegy1
New Scratcher
Registered: 2012-03-29
Posts: 4

Re: How to make a "Play Again?" feature in a game

Thank you guys.  I'm so clueless.  Hope I can learn from this.  Thanks again!

Offline

 

Board footer