Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » How can i get a sprite to
- Landrover110
- Scratcher
100+ posts
How can i get a sprite to
How can i get a sprite to stop if it is touching another sprite for example if I have a fish and a piece of fish food fell from the top of the screen to the bottom and you tell the fish to glide forever to the x and y position of the food and when it got to the food it must switch to the costume open mouth
and broadcast eaten when the food receives eaten it must hide
But the problem is that when the food is eaten the fish goes crazy
how would you get the fish to swim away once it has eaten the food and go do something else and forget about the eaten food
what I want is the fish to eat the falling food and then swim away
best regards
and broadcast eaten when the food receives eaten it must hide
But the problem is that when the food is eaten the fish goes crazy
how would you get the fish to swim away once it has eaten the food and go do something else and forget about the eaten food
what I want is the fish to eat the falling food and then swim away
best regards
- drmcw
- Scratcher
1000+ posts
How can i get a sprite to
If you have a forever block containing glide to x,y of fish food then yes it will go mad when the food is hidden. There are many ways to solve this. You need to break the forever block, so it only goes to the food when the food is not eaten, otherwise it glides elsewhere. You could use a variable and set it to 1 when eaten and 0 when not eaten and have that as an if then else block inside the forever. Difficult to make suggestions without seeing the actual project but hopefully that may point you in the right direction.
- Landrover110
- Scratcher
100+ posts
How can i get a sprite to
Thanks that worked I made a varible and the fish wold forever go to the food if the varible is 0 and when the fish ate the food the varible changed by 1
and this fish did not follow the food anymore
thankks again
and this fish did not follow the food anymore
thankks again
- Discussion Forums
- » Help with Scripts
- » How can i get a sprite to