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
Try breaking it up into many scripts, so that everything will happen at the same time almost, and it will run faster
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.
Offline
I think that having that many scripts will make the project size too big. You're only allowed to share 10 MB worth of any project. A much easier way to make this game instead of having all those "if" blocks is this: use broadcasting. If you don't know how to use broadcasting, look for tutorial projects on the site, look at the Scratch block descriptions online and offline in the Scratch program itself. Boradcasting will send a message to all the sprites, and then you can just put one simple script like this in every stone:
[blocks]<when I receive[ broadcast message name goes here[/blocks]
Do whatever you want the stones to do
So that's it! Now you will have MUCH more space! I hope that helped you! Happy Scratch-ing!
Offline