Alice Community How to use the mouse distance from left edge?

 How to use the mouse distance from left edge?
 Ben_the_Geek Guest   Status: Posts: n/a How to use the mouse distance from left edge? - 10-05-2009, 09:06 AM Hello, I was wondering how to use the function mouse distance from left edge in my code? what would thiks be used for?
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 10-05-2009, 07:59 PM It'd be used to do just that: track where the mouse cursor is on the screen. It can be used to have the camera follow the mouse, or to have objects move with the mouse.
 Ben_the_Geek Guest   Status: Posts: n/a 10-06-2009, 09:22 AM i want to make a object appear when it goes a certain distance away from the left edge....how would i use this function to accomplish my goal?
 x2495iiii Super Moderator     Status: Offline Posts: 3,508 Join Date: Dec 2008 Location: Somewhere in the Continental U.S. 10-06-2009, 03:40 PM First you should make a calibrator. To do that, create two variables, one called TopDist and one called LeftDist. Then, create a method that loops constantly, it can be a "While true," a "loop infinity times," or a "while the world is running" in the "during" part. Inside this method, have the variables both set their values to one. Then, go to the world's function tab and drag the "cursor distance from left edge" in place of the number one for the leftDist variable, and do the same for the topDist variable, but with the "distance from top edge" function. Now, if you play your world with the two varialbes in sight behind the Playing Window, you should be able to see what distance Alice recognizes the mouse is away from each edge. To make an object appear, just put in a "while leftDist > x" or "while leftDist < x" method, then have it trigger the method you want, like the object appearing.
 Ben_the_Geek Guest   Status: Posts: n/a 10-06-2009, 08:13 PM wow, thats pretty dang cool! Thanks so much! This helps me out a ton. Thank you again! Ben the Geek
 Ben_the_Geek Guest   Status: Posts: n/a 10-07-2009, 08:52 AM When i watch my variables they seem to stay at a value of 1. What am i doing wrong?
 Ben_the_Geek Guest   Status: Posts: n/a 10-07-2009, 10:01 AM Nevermind i got it to work right. thanks

 Thread Tools Display Modes Linear Mode

 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 Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Announcements     Community News and Announcements Alice 3     How Do I?     Works In Progress     Share Your World     Share Custom Classes     Bugs and Trouble Shooting     Suggestion Box Alice 2     How do I...?     Works-In-Progress     Share Worlds     Share Objects     Bugs and Troubleshooting     Suggestion Box Educators     Teaching with Alice     Teaching Using Alice 3     Teaching Using Alice 2     CS Principles and Alice     AP CSA and Intro to Java and Alice     Workshops     Alice Player and VR General Discussion     Questions and Comments     The Lounge