Really simple question

Posted By: rayp

Really simple question - 04/19/09 20:57

Im trying to make a small game like Warcraft 2. I need help for a really simple thing. How can i get the X,Y points of a mouse click (in world koord). Using MOUSE_POS.X is only for the current "screen" (upper left corner X=0). I need the real world x,y of the mouse click (to sent units there etc).

Edit: Its an sprite based game. My view is on top. Thats why i only need x,y. Just
working with MY.X and MY.Y, MY.Z is a fixed size.

Please help and thanx. smile
Posted By: Widi

Re: Really simple question - 04/19/09 21:53

my_vector.x = mouse_pos.x;
my_vector.y = mouse_pos.y;
my_vector.z = deep; // means how deep you click in the Level...

vec_for_screen (my_vector,camera);

Now my_vector have the coordinates.
Posted By: Jaxas

Re: Really simple question - 04/20/09 09:30

if you want to draw a selection box to, search for stratego2 example in AUM11 wink
Posted By: rayp

Re: Really simple question - 04/20/09 16:18

Cool! These tips helped alot!

Now the sprite is moving to X,Y. Next thing is a small and simple coll ^^
Posted By: jermy

Re: Really simple question - 05/01/09 13:38

Originally Posted By: Widi
my_vector.x = mouse_pos.x;
my_vector.y = mouse_pos.y;
my_vector.z = deep; // means how deep you click in the Level...

vec_for_screen (my_vector,camera);

Now my_vector have the coordinates.



thanks, it also helped me smile
© 2024 lite-C Forums