Alice Community  

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

Reply
 
Thread Tools Display Modes
Can crosshair vehicle with mouse?????
Old
waqar
Senior Member
 
Status: Offline
Posts: 51
Join Date: Sep 2011
Location: Pakistan
Default Can crosshair vehicle with mouse????? - 11-08-2011, 01:01 AM

Hi guys I am making a shooting game for that i am thinking to make a crosshair bt dont know how to vehicle it with mouse can anyone help me plz

Thanks in advance

Regards
Waqar Muhammad
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 11-08-2011, 04:09 PM

You can't parent something to the mouse as far as I can tell, but it is possible to move something roughly to where the mouse cursor is, though.

I did an experiment with this before. Perhaps this may help
(Download the one called "mousecursor_test3_optimal")


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389
   
Reply With Quote
Old
waqar
Senior Member
 
Status: Offline
Posts: 51
Join Date: Sep 2011
Location: Pakistan
Default 11-08-2011, 10:04 PM

Ty for helping me hope i can get something from it which is helpful for me and one more thing if u can tell me about that axis thing how what is the axis game in alice x , y , z axis waiting for ur reply and ty again
   
Reply With Quote
Here's how the world works (as best as I can explain it)
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default Here's how the world works (as best as I can explain it) - 11-08-2011, 11:15 PM

I'll explain how my mouse cursor system works

-(Make sure the screen has no black bars on the sides. The bars mess up the program. You can get rid of the bars, by resizing the world window and opening and closing it until the bars are gone.)

-When you click on the little dot in the center, it saves mouse cursor's distance from the top and left edges of the screen. Since the dot is in the center, you get roughly half the distances from the left and top edges of the screen. These values are saved as "x_middle" and "y_middle"

-If the "mouse cursor's distance from the left edge of the screen > 0" and less than "x_middle x 2" (the same applies for the top edge), a dummy object moves to where the mouse cursor is, (using some strange math I can't remember or fully explain Go to the updateCursor method to see the math) then the crosshair object moves to the dummy's position.

There may be other less complicated ways of doing this, but this is the way I came up with. Hope this explains it

(The updateCursor method really is only a few lines long, but the math was a bit hard. Also, the "move to" method's offset by parameter can be very useful! If you don't know what the "offset by" parameter does, this thread will explain it somewhere. )


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389
   
Reply With Quote
Old
waqar
Senior Member
 
Status: Offline
Posts: 51
Join Date: Sep 2011
Location: Pakistan
Default 11-09-2011, 12:29 PM

How u make that crosshair obj and how it appeast when we click on that red dot?
   
Reply With Quote
Old
zero00
Senior Member
 
zero00's Avatar
 
Status: Offline
Posts: 300
Join Date: Oct 2009
Default 11-09-2011, 04:13 PM

Quote:
Originally Posted by waqar View Post
How u make that crosshair obj...
I made a crosshair texture and put it on a square.
Quote:
Originally Posted by waqar View Post
...and how it appeast when we click on that red dot?
The crosshair has a property called "IsShowing" which is false when the world starts. If its false, the object is not visible in the game world at all.
When you click on the dot, the property is set to "true" and the crosshair becomes visible.


==============Some of my Games and Ideas===========

Sky Warrior: http://www.alice.org/community/showthread.php?t=6291
Health Bars: http://www.alice.org/community/showthread.php?p=36968#post36968
Sky Warrior: Dual Force: http://www.alice.org/community/showthread.php?t=7174

Want to make your own space game? http://www.alice.org/community/showthread.php?t=6389
   
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.