The problem is thus:
I have a background sprite which, when touch by the player's one, broadcasts a message. when the message is received, a sprite (a dialogue box for storyline) appears. The problem is, there are indefinite times which the player sprite may touch the background sprite, depending on the player's own decision and control. However, I only want the storyline box to appear on the first time the message is received. Is there a way to do this?
If not, the dialogue box appears all over again, which disrupts the storyline and annoys the player.
Thanks very much. I am really stuck at the moment. Any advise is appreciated.
Offline
Hi lestrade3333,
looks like you might want to try experimenting with a variable. How about a local variable that remembers if the dialog box has been shown? You could name it something like "shown", initialize with one value (like 0), and set it to something else (like 1) the first time it is displayed. Then you could either check that variable before broadcasting the message, or let your dialog box sprite appear only if the variable is still in its initial state.
I hope I didn't make this explanation too complicated, please feel free to ask again if I didn't make myself clear.
Offline
One method would be usign a "wait until" script.
On green flag
Wait until touching (other sprite)
Broadcast "Show Message Box"
That way, it will only appear the 1st time.
You might want to put in a short delay before the "wait until" part, to make sure it doesn't trigger straight away if the previous game was interupted with the player sprite touching the background sprite in question.
Offline
I answered in the other thread:^http://scratch.mit.edu/forums/viewtopic.php?id=5603
Please; one thread is enough...
Offline
Thanks folks, it worked. However, it still feels slightly redundunt to make a new variable every time...
Offline
lestrade3333 wrote:
Thanks folks, it worked. However, it still feels slightly redundunt to make a new variable every time...
Mayhem's method (described above) using the Wait Until block would not require any variables and would only fire once.
Offline