Hi, My son is writing a breakout like game, one thing we want to do is have multiple levels, so when all the sprites are hit (hidden) we want to advance the level and show all the sprites again and speed up the ball.
The part we are not sure the best way to do is to keep track of all the sprites being hidde and show all the sprites when the level changes.
My idea is to use a global variable that ticks down each time a sprite is hit, when the variable hits zero then have the sprites show themselves. Seems like there should be a better way, is there a way to have one sprite do something to another sprite (hide/show?)
thanks
Joel
Offline
you cannot set attibutes of other sprites (like visibility or color effect) from a different sprite. the tick idea is probbly the most practical i can think of. if, however, you want to keep track of each single sprite's showing state, i suggest you make a private variable and set it everytime it hides or shows.
Offline
jnylund wrote:
I just learned about "broadcast" isnt this a better way, is this new?
No, broadcast has been there for 3 years. That would probably a good way to do it.
Offline
Maybe you could have a sprite status list.
Offline