Mouse Click distinction to move and "shoot" (TGB)
by Joseph Williams · in Game Design and Creative Issues · 08/25/2008 (11:58 pm) · 4 replies
I am currently working on a project (TGB) that has the player character both move (if mouse is held in a position) and "shoot" (if mouse is just clicked) a weapon with the left mouse button. With facing and shooting behaviors working alright, I'm having difficulty creating a way for a behavior to recognize if the mouse is being held down to move to a position. I'm currently in college for game design, though I'm not going down the path of programming, and quite the novice with torque script. Any ideas on a behavior for this would be greatly appreciated. I assume a "dragging" function would be plausible, and somehow have the object move towards the mouse while it's being held and moved.
Thanks!
Thanks!
#2
08/26/2008 (9:39 am)
That would definitely work, though I wouldn't necessarily want the player character to shoot every time they are done moving. To move, a player holds the mouse button down and "drags" it to where they would like the character to move, and thus, the above would hold a problem with firing every time this is executed. A similar design scheme is, say, a Diablo game.
#3
Not sure how it's done in TorqueScript, but you can probably take timestamps and subtract the previous click from the current to decide what action to take.
08/26/2008 (9:48 am)
What you'll need to do then is to record the time taken between keypresses. If it was a really short period, fire. Tweak the number of milliseconds until happy.Not sure how it's done in TorqueScript, but you can probably take timestamps and subtract the previous click from the current to decide what action to take.
#4
08/26/2008 (9:56 am)
Ah, good idea! Thanks Ronny. I'll do some more research into Torque Script and try to figure that out.
Torque 3D Owner Ronny Bangsund
Torque Cheerleaders