Hello everyone. I'm trying to make a game where there is a turtle sprite, five plastic bottle sprites and five jellyfish sprites. I've set for the bottles and the jellyfish to move in random directions.
I want to know whether there is a way for me to write if the turtle touches any of the jellyfish, the score goes up by 100 and if the turtle touches any of the bottles, the score goes down by 100.
Currently, I can make it work by writing if Bottle A touches Sprite Turtle, the score goes down by 100, if Bottle B touches Sprite Turtle, the score goes down by 100... By doing something like this 10 times, 5 for the 5 bottles and 5 for the 5 jellyfish, it works.
But is there a way for me to group the bottles into a category and the jellyfish into another category, and write from the angle of the turtle, where it touches Category Bottles, score goes down by 100, and if it touches Category Jellyfish, score goes up by 100?
The easiest way is to check the .Picture of the sprite.
If you have lots of different looking sprites in the same category, you could init global lists of sprite components, one per category, and use generic blocks.
Thanks.
Should I use the if else blocks (if not jellyfish, then deduct 100 scores)?
That sounds reasonable.
If the blocks give you trouble, post them and the aia.
Thanks so much. It worked!