Discuss Scratch

Michaeliswrng121
New Scratcher
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
claudine_mbaye
Scratcher
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:
distancetodogdistancetonorthEnemy

Seems that your game will be very good
Michaeliswrng121
New Scratcher
6 posts

Making sensors help please!! Urgent!!!!

[

claudine_mbaye wrote:

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:
distancetodogdistancetonorthEnemy

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? and i only understood half of what you said O.o (don't understand big words) xD but thankk youu
cauzality
Scratcher
100+ posts

Making sensors help please!! Urgent!!!!

instead of
touchingcolor?
can't you just use
touchingbottomSensorSprite?
???
Michaeliswrng121
New Scratcher
6 posts

Making sensors help please!! Urgent!!!!

cauzality wrote:

instead of
touchingcolor?
can't you just use
touchingbottomSensorSprite?
???

That won't work :S i tried that
cauzality
Scratcher
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
Michaeliswrng121
New Scratcher
6 posts

Making sensors help please!! Urgent!!!!

cauzality wrote:

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

Last edited by Michaeliswrng121 (Feb. 7, 2014 07:43:52)

Michaeliswrng121
New Scratcher
6 posts

Making sensors help please!! Urgent!!!!

cauzality wrote:

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
New Scratcher
6 posts

Making sensors help please!! Urgent!!!!

cauzality wrote:

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
Scratcher
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
Scratcher
1000+ posts

Making sensors help please!! Urgent!!!!

Michaeliswrng121 wrote:

cauzality wrote:

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
Scratcher
67 posts

Making sensors help please!! Urgent!!!!

Michaeliswrng121 wrote:

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
You could do this:
whenclicked
foreverswitchcostumetosensor costumeswitchcostumetoregular normal character costume
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
Scratcher
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
Scratcher
1000+ posts

Making sensors help please!! Urgent!!!!

JsnPrkr wrote:

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.
Please don't necropost.

Powered by DjangoBB