Discuss Scratch

PH-zero
Scratcher
100+ posts

A "Restart" -block

Hey

We have a
stop []
But what you gonna do if you just want to shut all scripts down and restart the game?
You can't just use
stop [all]
because (logically) you can't put another block under this block.

So you need to mess around with messages.

this block would be easy to understand and i think it wouldn't be too
hard to implement it.

restart

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
DotDash
Scratcher
1000+ posts

A "Restart" -block

PH-zero wrote:

Hey

We have a
stop []
But what you gonna do if you just want to shut all scripts down and restart the game?
You can't just use
stop [all]
because (logically) you can't put another block under this block.

So you need to mess around with messages.

this block would be easy to understand and i think it wouldn't be too
hard to implement it.

restart
Maybe a drop-down?
Options:

restart [this script v]

restart [all v]

restart [other scripts in this sprite v]

restart [other sprites v]

Last edited by DotDash (Sept. 28, 2013 21:26:58)


My browser / operating system: MacOS Macintosh X 10.8.5, Chrome 29.0.1547.76, Flash 11.8 (release 800)
mitchboy
Scratcher
1000+ posts

A "Restart" -block

Uh, I can see a problem with this:

when gf clicked
forever
restart [this script v]

Capsicum annuum.
PH-zero
Scratcher
100+ posts

A "Restart" -block

Uh, I can see a problem with this:
when gf clicked
forever
restart [this script]

But that would be the same as:

when I receive [Start]
forever
broadcast [Start]

The script would only be restarted over and over, no need to worry .

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
PhirripSyrrip
Scratcher
500+ posts

A "Restart" -block

mitchboy wrote:

Uh, I can see a problem with this:

when gf clicked
forever
restart [this script v]
Why is that a problem?

; ; ; ; ; ; ; ;You thought I'd get away from you, didn't you?!
DotDash
Scratcher
1000+ posts

A "Restart" -block

mitchboy wrote:

Uh, I can see a problem with this:

when gf clicked
forever
restart [this script v]
define crash
crash

This gets the same results.

Last edited by DotDash (Sept. 29, 2013 12:19:57)


My browser / operating system: MacOS Macintosh X 10.8.5, Chrome 29.0.1547.76, Flash 11.8 (release 800)
firedrake969_test
Scratcher
500+ posts

A "Restart" -block

DotDash wrote:

mitchboy wrote:

Uh, I can see a problem with this:

when gf clicked
forever
restart [this script v]
define crash
crash

This gets the same results.
And broadcasting recursively. And

When [timer v] > (0)
play sound [annoying sound v]
but it was still added

Support.

Alt account of Firedrake969.

Rocket II: A black and white bitmap space game!

I seek not fame, but education.

;
mitchboy
Scratcher
1000+ posts

A "Restart" -block

I don't quite see a use for this.

Capsicum annuum.
PH-zero
Scratcher
100+ posts

A "Restart" -block

I don't quite see a use for this.

It has many uses:
-Restart the game automatically after game over
-Restart the game comfortable, just by pressing a key
-Getting back to the menue by pressing a key (If the menue is the start screen)

The big advantage is that really ALL loops and procedures get stopped.
and then *after* stopping everything, the project starts over.

with the
 stop [all] 
block you can stop everything, but you cannot do anything after this block.

And think it this way: we got the possibility to simulate a “stop-sing-pressed” event.
So why we shouldn't have the ability to simulate a “Green-flag-pressed” event.

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
xlk
Scratcher
100+ posts

A "Restart" -block

why not tell the player to press the green flag?

sccar3
Scratcher
100+ posts

A "Restart" -block

There's a really simple workaround I like to use:
Replace all “When gf Clicked” Blocks with “When I receive {Green Flag(or something similar)}”
Then make this script on any sprite(although it would make most sense to put in in stage)
when gf clicked
broadcast [Green Flag v]

Then whenever you want to restart, just broadcast Green Flag.

Last edited by sccar3 (Sept. 29, 2013 20:25:41)


10-year Scratch veteran. Fight me.
PH-zero
Scratcher
100+ posts

A "Restart" -block

There's a really simple workaround I like to use:
Replace all “When gf Clicked” Blocks with “When I receive ”
Then make this script on any sprite(although it would make most sense to put in in stage)
when gf clicked
broadcast [Green Flag]

Then whenever you want to restart, just broadcast Green Flag.

I also know this workaround. But then you have to put

when i receive [Stop]
Stop [all other scripts]

on every sprite otherwise some loops will not stop and the game
will be “synchronized”.

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
SuperNicky
Scratcher
100+ posts

A "Restart" -block

Um whats wrong with clicking the green flag


(excess characters removed by moderator - please don't spam)

Last edited by Paddle2See (June 10, 2021 23:13:31)


PH-zero
Scratcher
100+ posts

A "Restart" -block

Um whats wrong with clicking the stop sing?

In this case, we don't need a
 stop [all] 
But we got it anyway

Ever wanted to rotate the stage? Or to
go to x:() y:() z:() ::custom
Click me!
DadOfMrLog
Scratcher
1000+ posts

A "Restart" -block

@PH-zero:

There is a pretty simple workaround for this…

1. replace all your “when GF clicked” header blocks with “when timer>0.2”
2. wherever you want to restart place “reset timer” followed by “stop all”

Tada!

Note: if you do already use “reset timer” anywhere else (or plan to add it for some use other than above trick), and you have some scripts started by “when timer>0.2” that have stopped running by the time you do one of those resets, then you need to add some extra logic to ensure those extra resets get dealt with correctly.

Last edited by DadOfMrLog (Sept. 30, 2013 21:23:59)



Alternate account: TheLogFather –– HowTos and useful custom blocks (see studio). Examples below…


- String manipulation - - - X to power of Y - - - Clone point to clone - Detect New Scratcher - Speed tests studio -

Failord
Scratcher
1000+ posts

A "Restart" -block

Suggested before- and logically, it doesn't make sense. I need experience before I can get the job, but I need the job to get experience. A stack only runs when the script is running. The stack won't do anything at all if the script doesn't reach it. Therefore, it's self-defeating. There will be no “restart” stack, because Scratch doesn't work that way. The point is to figure out how to do it yourself- might I remind you that this is an educational site? Broadcasts, c-loops, etc. can get the job done. You just need to get familiar with the code.

if <key [space v] pressed> then //Now how is a script that isn't running going to respond to the boolean? It simply can't.
do stuff
restart
end

Last edited by Failord (Oct. 1, 2013 01:37:42)


Thanks for the ride, Scratch Team and community! Unfortunately, the time has come for me to move on from Scratch, so I'll no longer be using the forums. Thanks again, and farewell!
Invisible text! This will show you if a profile I claim to be mine IS mine. Just remember to visit the profile and see if I confirmed in the comments.
For old time's sake, see the revolutionary Laser Battle 2.0! Also see Unstoppable Game!

And no, the evil kumquats didn't alter my signature…
Diamond_Projects
Scratcher
100+ posts

A "Restart" -block

when green flag clicked
forever

reset timer
end


when [timer v] > (0.2)
restart :: control cap
What if someone does that?
It's the same as when stop sign clicked restart.

Last edited by Diamond_Projects (Sept. 17, 2014 13:07:52)

OmnipotentPotato
Scratcher
1000+ posts

A "Restart" -block

It would be nice to have a block that's like restart from label A or something like that. What it would do is bring the script back to where the block “Label A” is at. So, two blocks would be added:

Goto label [(label id)]
and
Label [(label id)]

The latter would just be ignored when running a script until it gets the first command, and then the script would jump backwards to the latter block. If there is no block with that id in the script, the goto block would just be ignored. They have blocks like these on the TI-BASIC programming language and they are beyond useful.
KingOfAwesome58219
Scratcher
1000+ posts

A "Restart" -block

Support. The workarounds are quite simple though -
- Have the user click the green flag.
- Replace all When Flag Clicked with a broadcast, then broadcast that whenever you want to restart.



Charles12310
Scratcher
1000+ posts

A "Restart" -block

Support. For all reasons above.


A few internet communication companies want to corrupt the internet by getting rid of net neutrality. Stop Them!

Powered by DjangoBB