Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How Do you restart your game
- flicksticks
-
Scratcher
2 posts
How Do you restart your game
i have tried to restart my game but no use can you help
- jokebookservice1
-
Scratcher
1000+ posts
How Do you restart your game
Hi!
Thanks for your question. Clicking the green flag in the top-right of your project will run all of the scripts that have a “When Green Flag Clicked” hat block at the top. The timer will reset, but any variables you've made won't unless you reset them yourself. It's a good idea to make a script that sets up your game at the beginning so that restarting it is easy. This type of script is called an initialization script.
If you change the size or position of your sprite, for example, there are blocks in the above script that will reset those attributes.
If you have any more questions, please do say! As a side note, you might get more targetted help in the “Help with Scripts” subforum for next time. I'll let a moderator know to move it.
Thanks for your question. Clicking the green flag in the top-right of your project will run all of the scripts that have a “When Green Flag Clicked” hat block at the top. The timer will reset, but any variables you've made won't unless you reset them yourself. It's a good idea to make a script that sets up your game at the beginning so that restarting it is easy. This type of script is called an initialization script.
when gf clicked
switch costume to [cat-1 v]
set size to (100) %
go to x: (0) y: (0)
set [level v] to (1)
switch backdrop to [first maze v]
If you change the size or position of your sprite, for example, there are blocks in the above script that will reset those attributes.
If you have any more questions, please do say! As a side note, you might get more targetted help in the “Help with Scripts” subforum for next time. I'll let a moderator know to move it.
- flicksticks
-
Scratcher
2 posts
How Do you restart your game
Thanks but i meant like say you died when you touched lava or another sprite. you restart the level. how?
- Discussion Forums
- » Help with Scripts
-
» How Do you restart your game