Hey all,
I'm working on a project for school such that I'm trying to create a Mancala game in Scratch. Recently I have been having problems with the "if" conditional. For the game, I need to have approx. 336 "if" conditionals to make the stones move. In my case, the program will spend time checking one conditional, but at the same time continue running the script AFTER the conditional, while the "if" is checking to see if it is T/F and running it's script. In result, the variables get incrediably messed up. What should I do???
Offline
It's kind of hard to envision how your code works. Could you upload the project, or could you show us what the script looks like?
Offline
In a single stack of blocks, the IF block will be done in sequence. That means the blocks following the IF block will not execute until the blocks inside the conditional are done processing or it has been determined that the conditional is false. Of course, if you fire off another script with a Broadcast block, you can run into sequence problems. If that is the case, try using the Broadcast and Wait block.
Offline
Here's the script (Pardon the format):
When Green Flag Clicked
Forever
If: Playerturn=1 AND NOT: AI=1 AND Touching Mouse Pointer AND Mouse Down
Set Beadmove to 5
Broadcast: Un#ball
Forever __
Change P4 by 1 |
Change P5 by -1 |
If P5=0 |-This peice of code is repeated 13 more times
Broadcast: Move | in the script with minor alterations.
Stop Script __|
Thats more or less the problem area. This particular script is copied 23 more times in the coding.
Last edited by Zolareelo (2009-05-06 09:18:55)
Offline
Paddle2See wrote:
Of course, if you fire off another script with a Broadcast block, you can run into sequence problems. If that is the case, try using the Broadcast and Wait block.
Hmm... that might be it, though it will be incrediably tedious to fix, what with 336 broadcast blocks floatin around in the code that i'm having problems with...
Doublepost!
Last edited by Zolareelo (2009-05-06 09:21:47)
Offline