Another way that you can reduce the amount of code you need to write for many objects, is to Group them together... If you have many enemies on the screen, you can group them together and just write the code for the group instead of each enemy if intersect (button "box", button "enemy1", "pixels") then answer "You lose"end ifif intersect (button "box", button "enemy33", "pixels") thenanswer "You lose"end ifif intersect (button "box", button "enemy34", "pixels") thenanswer "You lose"end if... They can be "Grouped" together (selecting all of them by pressing the mouse button and dragging it over them all) and given a name: Group "enemies" Then you can replace all the code above with the following code: repeat with i = 1 to 32 |
Home >