Alice Community  

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

Reply
 
Thread Tools Display Modes
Detect Mouse Location?
Old
JustasM
Guest
 
Status:
Posts: n/a
Question Detect Mouse Location? - 02-25-2009, 12:50 PM

I got an idea for a possible game, but for it to be effective, it would have to use mouse controls.

That is, I should be able to click on an object, and when I click on any other position in the world, the object would move to the point under the mouse cursor. I am aware that Alice is able to detect an object under the mouse cursor, but that does not really help, as if I click on the ground, anywhere, a move to function will always move the object to the center of the object, in this case, the ground, which is not what I need.

I was therefore wondering if anyone knew of some kind of workaround for this, or even if this is possible in the current version of Alice. I would understand if it wasn't, as the Alice world is 3D, while the mouse is 2D, but I would still like to know.

If there isn't, I have thought of a workaround myself, but it would be very tedious (require a setup of an entire grid of tiny objects), even though my game will be '2D' (at least to begin with)...

Thank you.
   
Reply With Quote
Old
DrJim
Guest
 
Status:
Posts: n/a
Default 02-25-2009, 11:10 PM

Take a look at http://www.alice.org/community/showt...ghlight=cursor and the other thread referenced - though they doesn't really address the 2D/3D part of the problem.
   
Reply With Quote
Old
JustasM
Guest
 
Status:
Posts: n/a
Default 02-26-2009, 12:56 AM

Hmm... I had seen this post before, but thank you for referring me back to it.
Now that I read over it all once more, I think I might have figured out something that might prove to work.. I'll have to experiment around a bit; but that's what Alice is all about!

Thank you for the reply.
   
Reply With Quote
Old
Ch0pStickS
Guest
 
Status:
Posts: n/a
Default 02-26-2009, 09:10 PM

Hey i have an idea. It's like the world in the thread previously posted, but except the screen will not turn with the mouse, but something else will, that is invisible. That will thus rotate, and then it will be point at the position on that the mouse is on. And then you can have an invisible object or dummy move in that direction until it's height = 0, then have it stop.

If you don't understand, ill explain it better later, don't have the time right now.
   
Reply With Quote
Old
JustasM
Guest
 
Status:
Posts: n/a
Default 02-27-2009, 12:46 AM

Hey ch0pStickS,
Yeah, I managed to do very similar, thanks to your code :] After deciphering it for a while, I made it such that when the mouse is moved left/right, it would measure the new horizontal distance, then move the object I need left/right accordingly (it helps it being only on a 2D plane). For the vertical distance, I did the same, just with moving up/down.

After messing a bit around with the code, I managed to make it work smoothly on my world.

Thanks!
   
Reply With Quote
Old
jgtarheel
Guest
 
Status:
Posts: n/a
Default 03-12-2009, 01:06 PM

would you mind posting a world with the mouse click movement incorporated into it? I have been working for weeks trying to figure it out, but i cannot get it to work.....
   
Reply With Quote
Old
JustasM
Guest
 
Status:
Posts: n/a
Default 03-13-2009, 10:21 AM

Quote:
Originally Posted by jgtarheel View Post
would you mind posting a world with the mouse click movement incorporated into it? I have been working for weeks trying to figure it out, but i cannot get it to work.....
Check out the "T.A.C.T." thread in the Works in Progress section. I have posted the most recent version up there. Take note that it only works on an improvised 2D plane, as the mouse can only move in 2 dimensions.

http://www.alice.org/community/showthread.php?t=2330

Last edited by JustasM; 03-13-2009 at 10:24 AM.
   
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 ©2023, Carnegie Mellon University
Alice 2.x © 1999-2012, Alice 3.x © 2008-2012, Carnegie Mellon University. All rights reserved.