Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Play again
- chesschaser
-
Scratcher
48 posts
Play again
I am wondering how you would add a play again button to my project.
https://scratch.mit.edu/projects/221514207/
Please don't edit
https://scratch.mit.edu/projects/221514207/
Please don't edit
- codeman1044
-
Scratcher
1000+ posts
Play again
I think that all you need to do is make the play again button function similar to your play button, where clicking it would broadcast to start the game.
- chesschaser
-
Scratcher
48 posts
Play again
my play setup stops via
after the button is pressed to prevent a glitch
stop [ v]
- deck26
-
Scratcher
1000+ posts
Play again
Why do you tell the play button to go to a fixed spot in a forever loop? It doesn't move so this is unnecessary.
The player sprite has a forever loop where the last block is ‘stop this script’ so the loop is pointless.
The player sprite's custom block script has a forever loop inside another but the internal one stops the project so neither loop is dong anything.
You should only use forever loops where they're required.
I couldn't see any reason why you couldn't do as @codeman1044 says.
The player sprite has a forever loop where the last block is ‘stop this script’ so the loop is pointless.
The player sprite's custom block script has a forever loop inside another but the internal one stops the project so neither loop is dong anything.
You should only use forever loops where they're required.
I couldn't see any reason why you couldn't do as @codeman1044 says.
- chesschaser
-
Scratcher
48 posts
Play again
Becuase I tried to put a play agin button in in the past but broke the game.
- deck26
-
Scratcher
1000+ posts
Play again
Becuase I tried to put a play agin button in in the past but broke the game.It's often easier to help if we can see your failed attempt. If necessary do this in a copy and share that.
- chesschaser
-
Scratcher
48 posts
Play again
How? I forgot the code because I thought it would break it!
Last edited by chesschaser (Sept. 24, 2019 10:03:39)
- deck26
-
Scratcher
1000+ posts
Play again
You already have a play button. Make a ‘play again’ button that does the same thing - easiest option would be to just make it anotehr costume of the same sprite.
If data values need reinitialising make sure you include the code for that. That is easiest to handle as some sort of ‘initialise’ broadcast which is good coding practice anyway - ie you should be doing this already. So when a new game starts (or restarts) you initialise vairalbes, costumes etc before any game play.
If data values need reinitialising make sure you include the code for that. That is easiest to handle as some sort of ‘initialise’ broadcast which is good coding practice anyway - ie you should be doing this already. So when a new game starts (or restarts) you initialise vairalbes, costumes etc before any game play.
- dominic305
-
Scratcher
500+ posts
Play again
when I receive [start v]
...
when gf clicked
broadcast [start v]
when this sprite clicked
broadcast [start v]
The first one is the script that executes when the flag is clicked right now, but where green flag is changed to when I receive
The second one is a new script you should add
The third one is what happens when you click ‘Start Over’
Last edited by dominic305 (Sept. 24, 2019 11:25:38)
- chesschaser
-
Scratcher
48 posts
Play again
The play sequence stops after you press the play button and the countdown finishes.
when I receive [playgame v]
stop [stop this script v]
- deck26
-
Scratcher
1000+ posts
Play again
The play sequence stops after you press the play button and the countdown finishes.But only because you tell it to! Make a broadcast before stopping the script to trigger a restart.when I receive [playgame v]stop [stop this script v]
- ecala999
-
New Scratcher
4 posts
Play again
Very important question!!!! How would I stop the code then make it play again automatically??? You guys are coding geniuses right?
- Discussion Forums
- » Help with Scripts
-
» Play again