Alice Community  

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

Thread Tools Display Modes
Prev Previous Post   Next Post Next
Use while mouse is clicked on something
Status: Offline
Posts: 195
Join Date: Jan 2007
Default Use while mouse is clicked on something - 10-13-2020, 08:37 AM

You have set this up well, actually, but another response pointed out that Alice 2 puts every event into a queue and will process them one after another no matter how long the wait is. (This is an issue that we have fixed in Alice 3, where you are able to use a setting to ignore multiple mouse-clicks)

Try this in Alice 2.
1) Right click on the "When mouse is clicked on... " tile
2) Select "Change to..."
3) Select "While mouse the mouse is pressed on something"
4) The tile will change so that you now have a Begin, a During, and End option.
5) Put your method call in either Begin or End, not During.

Begin and End execute the method one time either when you start to press the mouse or when you release the mouse. During will execute the method continuously as long as the mouse button is held.

This should work for you. I have attached a sample project as an illustration. Let m know if you have any other questions.

Don Slater
Alice Project

Originally Posted by facup94 View Post
I have a problem whit mouse events.
When i click multiple times, the method run multiple times too. But i want the method activates only when is not working at this time.
Sorry for my english.
I looking something like:
if (method is running = true)
do nothing
do something

But when i click multiple times this method continues running after i stop click (number of times i click).
Attached Files
File Type: a2w bunnyhop.a2w (313.2 KB, 0 views)

Don Slater
Alice Team
Carnegie Mellon University
Reply With Quote

method, mouse, multiple times

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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.