Game Development Community

Regarding Mouse Input

by Encore · in Torque Game Builder · 12/19/2006 (2:29 am) · 3 replies

Hi all,

my games primary input is mouse . My game is similar to other games in that by pressing left mouse button the hero fires a missile . Now in tgb there are only ONMOUSEUP and ONMOUSEDOWN callbacks , i dont want my player to press the leftmousebutton each time he wants to fire a missile , instead if he holds it then my player should fire continuously .

Now how do i achieve it in tgb ?

please help

thanks
encore

#1
12/19/2006 (4:03 am)
Well, like you just say, you can detect onMouseUp, and onMouseDown, so in between those you fire missiles. Use a schedule to schedule the missile launching, and cancel that schedule onMouseUp
#2
12/19/2006 (3:43 pm)
Hi ward ,

i did this exactly before i posted this question but the problem is that the scheduler seems to act in weird ways . Could you please show me some code so that i can make sure i am doing the right way . And moreover i was wondering if there was any other good way to achieve it .

thanks once again

encore
#3
12/31/2006 (4:49 pm)
You will find examples of the use of the scheduler in three tutorials: Whack-A-Mole Tutorial, Shooter Tutorial, and
Fish Game Tutorial.

One scheduler weirdness is that a dead hero can fire his gun if you are not careful. Learn how to use cancel() when your character dies. Documentation is in the TGB Reference.