Alice Community  

Go Back   Alice Community > Alice 2 > How do I...?

Reply
 
Thread Tools Display Modes
Using an array or parameter with an event handler (Need Help)
Old
ghosn
Guest
 
Status:
Posts: n/a
Default Using an array or parameter with an event handler (Need Help) - 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
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 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.
   
Reply With Quote
Old
ghosn
Guest
 
Status:
Posts: n/a
Default 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
   
Reply With Quote
Old
ghosn
Guest
 
Status:
Posts: n/a
Default 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
   
Reply With Quote
Old
x2495iiii
Super Moderator
 
x2495iiii's Avatar
 
Status: Offline
Posts: 3,508
Join Date: Dec 2008
Location: Somewhere in the Continental U.S.
Default 10-18-2009, 03:07 AM

No problem. Sorry I couldn't help more. If you need any more hints, let me know.
   
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



Copyright ©2020, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.