Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Weird glitch with script
- Dark-World
-
Scratcher
11 posts
Weird glitch with script
In a project that i'm making, i have a script that said:
The problem is that when I test it, scratch doesn't register when sprite 5 (CC) is touching sprite 6 and it's only when I go to see inside and test it (ie. drag “touching sprite 6” out and click on it) does it finally register.
pls help
when backdrop switches to [ background 11 v]
forever
repeat until <[z] = [1]>
if <touching [sprite 6 v] ?> then
set [z v] to [1]
change [death v] by (1)
go to x: (-214) y: (-50)
end
end
end
The problem is that when I test it, scratch doesn't register when sprite 5 (CC) is touching sprite 6 and it's only when I go to see inside and test it (ie. drag “touching sprite 6” out and click on it) does it finally register.
pls help
Last edited by Dark-World (Oct. 11, 2015 01:23:24)
- Dark-World
-
Scratcher
11 posts
Weird glitch with script
the game is at :
https://scratch.mit.edu/projects/80330940/
https://scratch.mit.edu/projects/80330940/
- Arthurtilly
-
Scratcher
1000+ posts
Weird glitch with script
Can you share the project? It might be that either sprite 5 or sprite 6 is hidden.
EDIT: Ninja'd
EDIT: Ninja'd
Last edited by Arthurtilly (Oct. 11, 2015 01:27:46)
- Arthurtilly
-
Scratcher
1000+ posts
Weird glitch with script
I'm afraid I can't find the script you're talking about. Where is it?
- Arthurtilly
-
Scratcher
1000+ posts
Weird glitch with script
Found it. The problem is that the script repeats until z=1. But z is always 1, so this script terminates immediately. You want to replace it with
<(z) > [1]>
- Sheep_tester
-
Scratcher
500+ posts
Weird glitch with script
You could rewrite the script as
when backdrop switches to [background11 v]
forever
wait until <touching [Sprite6 v] ?>
change [Deaths v] by (1)
go to x: (-214) y: (-50)
wait until <not <touching [Sprite6 v] ?>>
end
- Dark-World
-
Scratcher
11 posts
Weird glitch with script
http://ffffffffffffffffffffffffffffffffffff.weebly.com/uploads/1/9/8/4/19840665/9039209_orig.png
the screenshot
the screenshot
Last edited by Dark-World (Oct. 13, 2015 04:17:08)
- deck26
-
Scratcher
1000+ posts
Weird glitch with script
Screen shots aren't that useful. We need to look at the project, check what variables are doing and so on.
You do realise that the block
I'm not sure why removing those repeat until colour touching colour blocks makes any difference but if you use forever loops instead it seems to work. Mind you I've got things working several times by tweaking things but when I try to repeat it it doesn't work. I do wonder if something is corrupt in the project.
You do realise that the block
<color [#00ff00] is touching [#0000ff] ?>needs the first colour to be in the sprite that is running the block? So I'm not sure why the red block sprite is testing for this since it doesn't contain black so looking for black touching yellow is pointless.
I'm not sure why removing those repeat until colour touching colour blocks makes any difference but if you use forever loops instead it seems to work. Mind you I've got things working several times by tweaking things but when I try to repeat it it doesn't work. I do wonder if something is corrupt in the project.
- Discussion Forums
- » Help with Scripts
-
» Weird glitch with script