Game Development Community

Setting Mouse Cursor to Player Object?

by Stefan Sierder · in Torque X 2D · 08/14/2010 (4:34 pm) · 6 replies

Hello community,

i am trying to implement mouse movement for a space shooter, but i can't find a way
to set the current cursor position to my player object. I am already able to actually move
my player with the mouse (it reacts to state.X/state.Y) but since the cursor is not focused
on the player itself, it only works as long as i sty inside the world bounds or the player
dies and the position gets reseted.

I read about something like "setCursorPosition" in other versions on Torque... is there something
similar in Torque X 2D? Some code samples anywhere how to implement it to a starter game?

Thanks a lot in advantage.


#1
08/14/2010 (6:38 pm)
Hi Stefan,

the mouse control is not implemented in the current official Torque X release but it is in the unofficial release that I maintain (see here). If you post a request here using a licensed account and send me an email (address in my profile) I'll grant you access to the featured engine.

Cheers,
Pino
#2
08/15/2010 (10:04 am)
Hello Pino,

thanks for your offer, seems you should be paid for your work as far as i read ;)

At the moment i am still using the trial to evaluate the engine for
my purpose, so it will take some time for me to decide if i want
to actually buy it or not (i know 200$ is not much for an engine, but
it is for a student).

I coded a (dirty) workaround to bind my pointer to the player (just
positioned them on the same coords and adjusted speed to be the same
as cursor movement). Works so far, but i am sure your solution will be
a lot more stable (i used a custom, hardcoded bounding box for example since my hack doesn't make use of move.sticks - that sure sucks in professional sense)

I will check out the scene management to evaluate further, after that i
will decide to buy TX2D or check for another engine (and it seems with that, i am heading for another feature that is not quite implemented in TX2D or did i miss that in the docs? SceneManagement has to be done by
myself or?)

Thanks again for your quick reponse.
#3
08/15/2010 (10:52 am)
Hey Stefan,

in the 200$ there are both there, 2D and 3D, but I think the 2D is actually the real value in there. AFAIK Torque X is the only real engine on the market to have a quasi-professional grade game on both Xbox and Windows.

Can you elaborate what you expect as scene management? That is a quite wide expression :) About game management have a look to the FSM (Finite State Machine) class: that is a quite useful tool to get a good game properly done.

Feel free to ask if you need help to sort things out ;)

Pino
#4
08/18/2010 (11:37 pm)
may i also have a copy of your engine, i have sent you an email. thank you.

I have tried to send an email to this address "pino@nulldftgames.com". I sent an email twice and it seems to fail delivery. Is this email correct? My email is "p4ppy2004@hotmail.com" if that helps. Thank You.
#5
08/19/2010 (1:53 pm)
@Mohammad: that is a spam security of this website :) when you copy an email address the "null" is added so if you are a spambot you can't get the working email :) It's ok then, I'll send you the invitations.
#6
08/19/2010 (8:39 pm)
@Stefen: the paid version is totally worth it (specially if you want unofficial add-ons) and it's only going to be $200 for a day or two more, according to the 3.1.5 release blog post. Get it while its cheap!