In my current project, I have a variable called "Insert Number" on the stage with a slider that has min=1 and max=3. I want to be able to click on one of the squares in my 3x3 grid and have the number showing in the slider appear in that box. How can I do that?
Thank you!
Tricia
Last edited by Teacher617 (2009-02-07 16:58:31)
Offline
Teacher617 wrote:
In my current project, I have a variable called "Insert Number" on the stage with a slider that has min=1 and max=3. I want to be able to click on one of the squares in my 3x3 grid and have the number showing in the slider appear in that box. How can I do that?
Thank you!
Tricia
If I were you, I would make list to keep track of the grid. The numbers in the list would go horizontally. For instance:
_____________________________
Box 1 | Box 2 | Box 3 | Box 4|
_____________________________
Box 5 | Box 6 | etc.
So depending on how many boxes there are, at the beginning of the code you would say:
<when green flag clicked>
<repeat( Total Box # of times
Add item (0) to (list)
<end>
The actual boxes code would be tricky. You could create a separate sprite for each box, and then add something like the following code to each:
<when green flag clicked>
<forever>
<switch to costume[ item number (the boxes number)
AND
<when[ Box ___ ]clicked>
insert (slider variable) at (Box #)
(Note: You would have the box with four costumes, one blank costume, one costume with "1" in it, one costume with "2" in it, one costume with "3" in it, etc.)
If you did not want to mess with that many sprites, you could also do a lot of coding. You could have just one sprite that said something like this:
<when green flag clicked>
<forever>
<if><mouse down?>
<if> << <( <x position><<> So and So )><and> <( <x position> <>> So and So )> >>
Insert (slider variable) at (Box #
The second method would be very difficult and time consuming, so I suggest you go with the first option. I hope I could help!
Offline
Thank you - will try your first option, and see how it turns out. Appreciate the help!!
Offline