I am making a game where a sprite (bat) has to through a small maze to the finish. At the end of each maze, there is a small green dot which acts like a portal. What I want: When the bat touches the portal the background (level) will switch to the next background (level). At the moment I have four different backgrounds (Levels). At the moment I have programmed it to: When colour black (Bat) touches colour (green), it switches to Level3, and then when black touches green again it switches back to level 1. I want the order to be Level 1, 2, 3, 4. How can I make surethat will definately happen? Please help!
Offline
not sure if this is the best method but you could use broadcast to do different things depending on a level counter variable.
give your bat the following:
if < touching [green v] ? >
if < [level v] = [1] >
broadcast [level 2 v]
end
if < [level v] = [2] >
broadcast [level 3 v]
end
end
and use things like this to control what happens for each level:when I receive [level 2 v] hide level 1 things show level 2 things etc... end
Offline
oh yeah, don't forget to change the level variable
if < touching [green v] ? >
if < [level v] = [1] >
broadcast [level 2 v]
end
if < [level v] = [2] >
broadcast [level 3 v]
end
change [level v] by [1]
end
Offline