Reputation: 157
I have four identical scratch sprites, but only one of them do what I expect and I need to know why so I can continue with my project
I have tried reloading the page multiple times but it still won't work
When (Green Flag) clicked forever: if touching mouse-pointer? then: set (Enclosure Hover) to 1 else: set (Enclosure hover) to 0
I expect this to change Enclosure Hover to 1 when the mouse is touching it but it doesn't change it at all.
Upvotes: 2
Views: 706
Reputation: 11
If 1 sprite tries to set [Enclosure Hover] to 1, it will only happen for a split second because the other sprites that are not touching the mouse pointer, are setting it to 0.
FIX: Make multiple variables (with different names) for each sprite and check if any of the variables are 1, then set [Enclosed Hover] to 1 else set it to 0
Upvotes: 1
Reputation: 61
You will need to duplicate the sprite only after the sprite has the code in it so that the 4 sprites do the same thing. I guess what you have been doing is to duplicate the sprites then adding the script into only one of them.
Upvotes: 0
Reputation:
If the variable is global, all sprites will compete to change it. Hope that helps!
Upvotes: 2
Reputation: 245
One way is to add code to one sprite, then duplicate the sprite with the code in it. The code will be duplicated along with the new sprite.
Upvotes: 0
Reputation: 843
You have to add the code to all the sprites that you want. Duplicating a sprite, then adding code to one of the sprites does not add the code to every sprite.
Upvotes: 0