Discuss Scratch
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
I am making a game and there is this glitch where when ever the play is knocked out and the player tries to play again the player will doe its K.O. animation unless the person playing the game plays again.
- YoshiGirl153
-
Scratcher
500+ posts
Knockout glitch.
Hi! This forum is for bugs and glitches about Scratch, not about projects. If you need help, I would recommend that you ask this in the Help With Scripts forum! In the future, please post in the correct forum. Thanks! 
Edit: Thanks to the person who asked someone to move this! (This used to be in another forum)

Edit: Thanks to the person who asked someone to move this! (This used to be in another forum)

Last edited by YoshiGirl153 (July 19, 2022 03:52:41)
- Adzboy
-
Scratcher
1000+ posts
Knockout glitch.
Dearie, Silly me. Thank you YoshiGirl153.I'll ask a Scratch Team member to move this topic over there for you

Last edited by Adzboy (July 15, 2022 15:15:29)
- GlueGourmand
-
Scratcher
100+ posts
Knockout glitch.
Hi, Geeniya. Let me be sure that I understand you correctly… is the problem that your project only works when you click the green flag and not when you ask it for another game in your scripts?
If this is the case, it is probably a situation where you have rogue ‘Green Flag Clicked’ blocks that initialize your data and variables that are not being triggered by your in-game ‘play again’ system. You will have an easier time debugging if instead of 40 ‘Green Flag Clicked’ blocks, you have one such block that sends a message like ‘initialize’ to the rest of your project. This will reduce the chances of you having stale data on reset, and resetting the game field becomes as simple as sending that message again.
It is very possible that I misunderstood what you are asking for. If that is the case, post the project link here with a detailed description of expected and actual behaviors, and we would be happy to take a look at it for you.
If this is the case, it is probably a situation where you have rogue ‘Green Flag Clicked’ blocks that initialize your data and variables that are not being triggered by your in-game ‘play again’ system. You will have an easier time debugging if instead of 40 ‘Green Flag Clicked’ blocks, you have one such block that sends a message like ‘initialize’ to the rest of your project. This will reduce the chances of you having stale data on reset, and resetting the game field becomes as simple as sending that message again.
It is very possible that I misunderstood what you are asking for. If that is the case, post the project link here with a detailed description of expected and actual behaviors, and we would be happy to take a look at it for you.
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
It only happens when I click the green flag and then it never happens again until the player gets KOed again and how do I post you a link for the game without sharing it?
- GlueGourmand
-
Scratcher
100+ posts
Knockout glitch.
I don't think there is a way to post a game without sharing it, but you can easily go back and delete the shared version once you have an answer to your question. If you could share the project in its current form, that would help the debugging process a lot.
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
OK but I will have to change the project's name and post warning for scratchers that are not you and please, don't leak any of this stuff.Alright?
- cIoudyness
-
Scratcher
500+ posts
Knockout glitch.
OK but I will have to change the project's name and post warning for scratchers that are not you and please, don't leak any of this stuff.Alright?I don’t think it’s a big deal (because you’re not gonna get ddos’ed for a random scratch project among six hundred million)
turbowarp still works right?
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
Here's my project link:
https://scratch.mit.edu/projects/615211981
This is how you activate the glitch:
1. Go to survival(or the extreme version of survival mode which is in the extreme button) mode.
2. Try to get Knocked out early.
3.Press back in the results screen.
4.Press ONLY the survival mode button.
5.Then see how the glitch works in the game.
thats how the glitch works and funnily enough, this glitch does not happen in the extreme version of survival mode.So, can you please figure out what is going on with this glitch and how I can fix it?
P.S. I change the title on purpose so no other scratcher can stumble upon it.
https://scratch.mit.edu/projects/615211981
This is how you activate the glitch:
1. Go to survival(or the extreme version of survival mode which is in the extreme button) mode.
2. Try to get Knocked out early.
3.Press back in the results screen.
4.Press ONLY the survival mode button.
5.Then see how the glitch works in the game.
thats how the glitch works and funnily enough, this glitch does not happen in the extreme version of survival mode.So, can you please figure out what is going on with this glitch and how I can fix it?
P.S. I change the title on purpose so no other scratcher can stumble upon it.
- skeletonsteveplays
-
Scratcher
100+ posts
Knockout glitch.
Here's my project link:
https://scratch.mit.edu/projects/615211981
This is how you activate the glitch:
1. Go to survival(or the extreme version of survival mode which is in the extreme button) mode.
2. Try to get Knocked out early.
3.Press back in the results screen.
4.Press ONLY the survival mode button.
5.Then see how the glitch works in the game.
thats how the glitch works and funnily enough, this glitch does not happen in the extreme version of survival mode.So, can you please figure out what is going on with this glitch and how I can fix it?
P.S. I change the title on purpose so no other scratcher can stumble upon it.
I think I fixed it: https://scratch.mit.edu/projects/715738536/ , the fix is in the Results Characters sprite
Last edited by skeletonsteveplays (July 20, 2022 18:54:19)
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
Here's my project link:
https://scratch.mit.edu/projects/615211981
This is how you activate the glitch:
1. Go to survival(or the extreme version of survival mode which is in the extreme button) mode.
2. Try to get Knocked out early.
3.Press back in the results screen.
4.Press ONLY the survival mode button.
5.Then see how the glitch works in the game.
thats how the glitch works and funnily enough, this glitch does not happen in the extreme version of survival mode.So, can you please figure out what is going on with this glitch and how I can fix it?
P.S. I change the title on purpose so no other scratcher can stumble upon it.
I think I fixed it: https://scratch.mit.edu/projects/715738536/ , the fix is in the Results Characters sprite
Oh.How did you Fix it?
- skeletonsteveplays
-
Scratcher
100+ posts
Knockout glitch.
The fix is in the Results Screen block. Also, https://scratch.mit.edu/projects/715531519/ is the correct link.
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
Yeah, but the glitch is half fixed.When you click the green flag while getting knocked out and the you play survival mode, the glitch happens and it does not happen when you don't click the green flag, but the fruits are duplicated.
- skeletonsteveplays
-
Scratcher
100+ posts
Knockout glitch.
Yeah, but the glitch is half fixed.When you click the green flag while getting knocked out and the you play survival mode, the glitch happens and it does not happen when you don't click the green flag, but the fruits are duplicated.
This script might fix the glitch.
when green flag clicked
set [lives] to [6]
Last edited by skeletonsteveplays (July 21, 2022 00:17:41)
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
Yeah, but the glitch is half fixed.When you click the green flag while getting knocked out and the you play survival mode, the glitch happens and it does not happen when you don't click the green flag, but the fruits are duplicated.
This script might fix the glitch.when green flag clicked
set [lives] to [6]
That piece of code is already in the project and it still didn't work.
- Alberknyis
-
Scratcher
1000+ posts
Knockout glitch.
This problem occurs because the order the scripts run is not the way you were hoping for. Take a look at these two scripts:

When the game has just reset, your Lives are currently at 0. In this moment, it's a race between the clock to whichever script runs first. In your case, the one on the right runs first and you immediately K.O before you get a chance to reset your lives.
The key to avoiding problems like this is to avoid ambiguity. There are two main steps to doing so:

When the game has just reset, your Lives are currently at 0. In this moment, it's a race between the clock to whichever script runs first. In your case, the one on the right runs first and you immediately K.O before you get a chance to reset your lives.
The key to avoiding problems like this is to avoid ambiguity. There are two main steps to doing so:
- Minimise the number of scripts that are activated by an event. For every one of them you have, there is more uncertainty. Which one will run first? Will the order cause a problem? Only one script needs to activate in the wrong order for this to happen. Minimising scripts means combining multiple scripts into one, which makes it clear what will run first:

- Force events to happen in a specific order. Merging things into a single script helps within a sprite, but what if you have multiple sprites, each doing their own thing? How do you control them? Broadcasting is a great way to do this. You can name the broadcasts so you know what each of them mean, and it lets you setup a “control” script which keeps the other sprites in sync:

Last edited by Alberknyis (July 21, 2022 03:47:07)
- Geeniya
-
New Scratcher
36 posts
Knockout glitch.
Could you please define the second strategy with the broadcasting code, I don't understand it.
- Alberknyis
-
Scratcher
1000+ posts
Knockout glitch.
broadcast [Initialise Survival v] and wait
Some things have to be done before the game starts or there will be problems (like setting the lives to 6, putting the player in the starting position), so this broadcast signal tells sprites to do those things first.
broadcast [Play Survival v] and wait
This only runs after the block before is finished, and this is where the “game” starts. The player should move, fruits should fall and it should check when the player is dead only once this broadcast is received.