Alice Community  

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

Reply
 
Thread Tools Display Modes
How do I make a mouse click do multiple actions
Old
Enzo
Guest
 
Status:
Posts: n/a
Default How do I make a mouse click do multiple actions - 06-21-2010, 04:26 PM

I'm very new to Alice and programming and i'm trying to learn how to tie multiple actions to a mouse clicking the same object. In this case Im trying to make a mouseclick start windmill blades turning when I click on the windmill if the blades are stopped, then when clicked on the windmill again if the blades are turning, make it stop. I have been able to get the windmill to begin turning, but can't get it to stop.

Can someone please give me some adivce on what the logic for this should be and how to create it. I would be greatly appreciated.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-21-2010, 06:04 PM

You need the 'Do in Order' Block. It is located under the method editor, colored yellow. Drag this into the mouse click method, and it will act just like 'My first method' or any other method.

Here's a visual:


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
Reply With Quote
Another Option
Old
MrMoke
Senior Member
 
MrMoke's Avatar
 
Status: Offline
Posts: 501
Join Date: Sep 2007
Location: Austin, Texas
Default Another Option - 06-23-2010, 11:37 AM

The above suggestion will work, but it tends to clutter the tiny little Events Panel.

An easier option is to create a new World Method, and call it whenever the mouse is clicked. This gives you significant control, and allows the method to operate in parallel with others.
   
Reply With Quote
Old
zonedabone
Senior Member
 
zonedabone's Avatar
 
Status: Offline
Posts: 577
Join Date: Nov 2008
Location: In the interwebs
Default 06-23-2010, 12:38 PM

If you look at the do in order box, in the top left corner, you see a minus sign. That minimises the do-in-order, and saves space on the screen. Also, I think that calling methods takes a minute amount of time, and that can add up. It's very small though.


'Apple Macintosh' - An anagram of 'Complaints Heap'

M.A.C.I.N.T.O.S.H. - Machine Always Crashes, If Not, The Operating System Hangs.

You're *such* a mac person.
   
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 ©2021, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.