Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Making sensors help please!! Urgent!!!!
- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
I have made sensors in my game, bottom sensor, right sensor, left sensor (Sprites), the bottom sensor is pink, right is green and left is orange. Currently they have the script “When Greenflag is click, change ghost effect by 100” and "When greenflag is clicked, forever, go to x: y: . The enemy's script is whenever it is touching pink, hide and change score by 20. and when it is touching green or orange hide and change lives by -1 (Note that this is shortened), however this only work when the sensors are shown and not when the sensors are hidden or has a ghost effect on. Does anyone know how I can hide the sensors and still have the lives go down when the enemy touches the right/left sensors of my main character and make the enemy disappear and change score by 20 when it touches the bottom sensor? (PS my game is on controlling scooby doo to catch healthy foods which are falling from the sky)
pleasee this is urgent!
thank you <3
pleasee this is urgent!
thank you <3

- claudine_mbaye
-
100+ posts
Making sensors help please!! Urgent!!!!
When you hide a sprite, it is not used for both “touching color” sensors.
I'm surprised for the ghost effect, but you might be true.
When a sprite is not in a front layer and is “behind” another sprite it is not shown at the screen, but it IS USED for both “touching color” sensors. However, your enemy should keep being behind something else.
Now I think no solution is adequate for your problem. So, let's see if there is a “mitigation” by weakening your requirements.
Suppose that instead of touching colored dots, you just compute the distance of the dog to the colored dots and decide on that basis if the invisible ennemy touches the dog.
Then you could replace your code “touching color” by a distance computation and the invisible enemy can be hidden in that case.
To simplify the computation, you can replace the colored dots with 4 invisible clones of the invisible enemy that are moving at some distance of the invisible enemy (north, south, …) and then you use those invisible clones to compute the distance between the dog and the invisible enemy with:
Seems that your game will be very good
I'm surprised for the ghost effect, but you might be true.
When a sprite is not in a front layer and is “behind” another sprite it is not shown at the screen, but it IS USED for both “touching color” sensors. However, your enemy should keep being behind something else.
Now I think no solution is adequate for your problem. So, let's see if there is a “mitigation” by weakening your requirements.
Suppose that instead of touching colored dots, you just compute the distance of the dog to the colored dots and decide on that basis if the invisible ennemy touches the dog.
Then you could replace your code “touching color” by a distance computation and the invisible enemy can be hidden in that case.
To simplify the computation, you can replace the colored dots with 4 invisible clones of the invisible enemy that are moving at some distance of the invisible enemy (north, south, …) and then you use those invisible clones to compute the distance between the dog and the invisible enemy with:
Seems that your game will be very good

- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
[
Well, actually before the ghost effect was CHANGE ghost effect to 100, but i then experimented and changed it to SET ghost effect 100 and it worked, but then it suddenly stopped working?
and i only understood half of what you said O.o (don't understand big words) xD but thankk youu
When you hide a sprite, it is not used for both “touching color” sensors.
I'm surprised for the ghost effect, but you might be true.
When a sprite is not in a front layer and is “behind” another sprite it is not shown at the screen, but it IS USED for both “touching color” sensors. However, your enemy should keep being behind something else.
Now I think no solution is adequate for your problem. So, let's see if there is a “mitigation” by weakening your requirements.
Suppose that instead of touching colored dots, you just compute the distance of the dog to the colored dots and decide on that basis if the invisible ennemy touches the dog.
Then you could replace your code “touching color” by a distance computation and the invisible enemy can be hidden in that case.
To simplify the computation, you can replace the colored dots with 4 invisible clones of the invisible enemy that are moving at some distance of the invisible enemy (north, south, …) and then you use those invisible clones to compute the distance between the dog and the invisible enemy with:
Seems that your game will be very good
Well, actually before the ghost effect was CHANGE ghost effect to 100, but i then experimented and changed it to SET ghost effect 100 and it worked, but then it suddenly stopped working?

- cauzality
-
100+ posts
Making sensors help please!! Urgent!!!!
instead of
can't you just use
???
- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
instead ofcan't you just use???
That won't work :S i tried that
- cauzality
-
100+ posts
Making sensors help please!! Urgent!!!!
no offense, but i didn't believe you so made my own… it works for me. if you'd like, you can share your project and i will try to help identify the problem.
http://scratch.mit.edu/projects/17616587/#player
http://scratch.mit.edu/projects/17616587/#player
- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
no offense, but i didn't believe you so made my own… it works for me. if you'd like, you can share your project and i will try to help identify the problem.
http://scratch.mit.edu/projects/17616587/#player
Lol none taken, i'm pretty bad at scratch and omfgggggggg thank you so much <3
i'll try it and hopefully it works

Last edited by Michaeliswrng121 (Feb. 7, 2014 07:43:52)
- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
no offense, but i didn't believe you so made my own… it works for me. if you'd like, you can share your project and i will try to help identify the problem.
http://scratch.mit.edu/projects/17616587/#player
OMG DUDE IT WORKKKKKKKKKKKEEDDDD awehgnberkhjrhnl <3 idk what i did wrong but omfggggg thank you so muchhhhhhhhh. It was urgent because i'm doing a coursework on scratch for ICT (Subject based on computers) and this was my last problem fomadhsnbgjreg and omfggg you're a life saver oemhklftmhkfthnjk, ily.
thanks to everyone who replied!!!!!!!!!!!!!!!!




- Michaeliswrng121
-
6 posts
Making sensors help please!! Urgent!!!!
no offense, but i didn't believe you so made my own… it works for me. if you'd like, you can share your project and i will try to help identify the problem.
http://scratch.mit.edu/projects/17616587/#player
It worked for most of the time and I just tried it and it stopped :S
- cauzality
-
100+ posts
Making sensors help please!! Urgent!!!!
share your project and maybe i can help, i don't know what's going on - kinda stumped.
- liam48D
-
1000+ posts
Making sensors help please!! Urgent!!!!
no offense, but i didn't believe you so made my own… it works for me. if you'd like, you can share your project and i will try to help identify the problem.
http://scratch.mit.edu/projects/17616587/#player
Lol none taken, i'm pretty bad at scratch and omfgggggggg thank you so much <3
i'll try it and hopefully it works:S btw i'm using scratch 1.4 since my school has that version
Uh, no swearing.

- kmissioneer
-
67 posts
Making sensors help please!! Urgent!!!!
You could do this: I have made sensors in my game, bottom sensor, right sensor, left sensor (Sprites), the bottom sensor is pink, right is green and left is orange. Currently they have the script “When Greenflag is click, change ghost effect by 100” and "When greenflag is clicked, forever, go to x: y: . The enemy's script is whenever it is touching pink, hide and change score by 20. and when it is touching green or orange hide and change lives by -1 (Note that this is shortened), however this only work when the sensors are shown and not when the sensors are hidden or has a ghost effect on. Does anyone know how I can hide the sensors and still have the lives go down when the enemy touches the right/left sensors of my main character and make the enemy disappear and change score by 20 when it touches the bottom sensor? (PS my game is on controlling scooby doo to catch healthy foods which are falling from the sky)
pleasee this is urgent!
thank you <3
That makes it where the program registers the color when something touches it, but a person only sees the character costume, not the sensor costume, because it is flickering too fast for the eye to see. You could make the sensor costume be just a square with each side being a different color, in one costume.
Last edited by kmissioneer (Feb. 8, 2014 00:17:20)
- JsnPrkr
-
100+ posts
Making sensors help please!! Urgent!!!!
Happily, Scratch 2.0 lets sprites detect color even when they're hidden. Even so, what I usually do would work on Scratch 1.4: separate the sensor and the character. I build a sprite that's just sensors and then create a sprite of the character with a . Make sure the character is in front of the sensor sprite and it will (usually) cover up the sensor sprite. You can also make the sensor sprite the same color as background or make it from really thin lines to hide it. Note that ghost effect doesn't have to be zero to make something practically disappear. You can leave it just solid enough to see and the player won't see it. And yes, no swearing.
- CatsUnited
-
1000+ posts
Making sensors help please!! Urgent!!!!
Please don't necropost. Happily, Scratch 2.0 lets sprites detect color even when they're hidden. Even so, what I usually do would work on Scratch 1.4: separate the sensor and the character. I build a sprite that's just sensors and then create a sprite of the character with a . Make sure the character is in front of the sensor sprite and it will (usually) cover up the sensor sprite. You can also make the sensor sprite the same color as background or make it from really thin lines to hide it. Note that ghost effect doesn't have to be zero to make something practically disappear. You can leave it just solid enough to see and the player won't see it. And yes, no swearing.
- Discussion Forums
- » Help with Scripts
-
» Making sensors help please!! Urgent!!!!