PDA

View Full Version : Using an array or parameter with an event handler (Need Help)


ghosn
10-15-2009, 12:16 AM
Hello,
I'm creating a tic tac toe game with 9 squares and hidden x's and o's and 2 players. I'm trying to get the player to select a square but have run into an issue with Alice (I know how this would be coded conceptually but cant figure it out in alice)

I have the WHEN MOUSE CLICKED ON anything DO none
I want to say WHEN MOUSE CLICKED ON one of the objects of an array DO revealXO

but cant seem to do that with alice

I also tried WHEN MOUSE CLICKED ON anything DO set parameter value to the clicked on object
But couldnt do that either.

Third try:
WHEN MOUSE CLICKED ON anything DO checkBox
Using a loop, I wanted to check to see if the object clicked on was box1, 2, 3, etc


How can I get Alice to set the value of the parameter to the object clicked?

Thanks

x2495iiii
10-15-2009, 12:51 AM
Actually the third thing should have worked, provided you passed the object under the mouse cursor as a parameter. If you check that parameter to see if it is a certain object, you can have Alice react accordingly when that object is clicked.

ghosn
10-18-2009, 12:14 AM
I assumed #3 would work but I cant seem to pass the object licked to a parameter...not sure how to do it

ghosn
10-18-2009, 12:41 AM
ok...I just figured it out...If you dont notice the expressions at the start and insert different values...you wont have the option to choose expressions again - so I was try all combinations but probably kept on missing the expressions

So i added "ïs clicked on anything, do method(object under mouse)"

Thanks

x2495iiii
10-18-2009, 03:07 AM
No problem. Sorry I couldn't help more. If you need any more hints, let me know.