Alice Community  

Go Back   Alice Community > Alice 2 > Share Worlds

Reply
 
Thread Tools Display Modes
Object Follows Mouse!
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default Object Follows Mouse! - 11-02-2010, 08:50 PM

I finally did it!! I made a mouse pointer program a long time back and I didn't understand why it went so slow, but now I have finally tried to redo that (upon the request of another member of the forums), and I have come up with a new way that very accurately tracks the movement of your mouse, No matter what the dimensions of your screen! You can even have those weird black spaces on the sides from stretching out the screen too much, and it will still track flawlessly (I think).

Yes, I know, it is pretty complicated. There is actually a much more basic way of doing it, but it would not provide the flexibility that this one provides (allowing you to have different dimensions of your screen). I might make the basic one later and attach it to this post as well just for those who want to put this into their program without all of the fancy work that this one has. By the way, please tell me if the pointer does not track your mouse perfectly.

Tell me what you think. (And your welcome Mario620)
Attached Files
File Type: a2w MovePointer2.0.a2w (469.9 KB, 323 views)


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301

Last edited by Dameria; 11-02-2010 at 09:15 PM.
   
Reply With Quote
Old
Mario620
Guest
 
Status:
Posts: n/a
Default 11-02-2010, 09:21 PM

Ah, thanks a lot!
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-02-2010, 09:22 PM

So do you understand it or do you want me to create a simpler version? If I do make the simpler version I will create it tomorrow, I have no more time today.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
Mario620
Guest
 
Status:
Posts: n/a
Default 11-02-2010, 09:25 PM

I understand a bit of it, there are some parts that I don't really understand though. It's up to you though, I'd love a simpler version but I wouldn't want to request so much of you as you've already helped me out lots. Thanks again!
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-02-2010, 09:31 PM

Does it work perfectly for you too? Like, not even a small amount of change, no matter where you go? I programmed it so that when you put your mouse out of the box, it just stops until you go back into the box. Does the pointer go slightly further or less than the mouse, or is it perfect for you?


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
Reply With Quote
Old
Mario620
Guest
 
Status:
Posts: n/a
Default 11-02-2010, 09:32 PM

Yeah, it's perfect and right on. Unlike your older one which I had a look at, this one pretty much instantly follows the mouse.
   
Reply With Quote
Old
Akira101
Guest
 
Status:
Posts: n/a
Default 11-03-2010, 03:59 PM

Nice, looks a bit complicated, but thats just cause I'm still kinda new
   
Reply With Quote
Very nice...
Old
cheesepuffgd
Guest
 
Status:
Posts: n/a
Default Very nice... - 11-17-2010, 07:48 PM

thats a very good way to do it. I think that it might be better saved as a class so people could import it into projects...

just a suggestion. thanks for the code! this Makes FPS much easier

Last edited by cheesepuffgd; 11-19-2010 at 12:33 PM.
   
Reply With Quote
Old
ndv92
Guest
 
Status:
Posts: n/a
Default 11-20-2010, 11:41 AM

Could you help me with making an object follow mouse but the distance from it to ground is constant?
   
Reply With Quote
Old
Dameria
Senior Member
 
Dameria's Avatar
 
Status: Offline
Posts: 978
Join Date: Sep 2009
Location: United States
Default 11-20-2010, 10:49 PM

Quote:
Originally Posted by ndv92 View Post
Could you help me with making an object follow mouse but the distance from it to ground is constant?
I believe that there's already an event for that, its called "Let mouse move (object)", look in the events panel for it.


Check out my best projects so far and please comment:

Tic-Tac-Toe 2.0 ................... http://www.alice.org/community/showthread.php?t=3548
Alice Paint ........................... http://www.alice.org/community/showthread.php?p=23408
Real-Time Clock .................. http://www.alice.org/community/showthread.php?p=12725
Maze Game ......................... http://www.alice.org/community/showthread.php?t=4301
   
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 ©2019, Carnegie Mellon University
Alice 2.x 1999-2012, Alice 3.x 2008-2012, Carnegie Mellon University. All rights reserved.