Game Development Community

Firing Delay - Can you help?

by Harvey Greensall · in Torque Game Engine Advanced · 05/13/2008 (12:29 pm) · 5 replies

Hi All. I think this would be covered by a firing delay.....but can't quite get it....

Any ideas how I could have a delay after you hit fire. Kind of like the crossbows arrow is a firework rocket?. You hit fire, but rather than shooting instantly it has the effect of lighting a fuse , it sits on the crossbow for a few seconds, still emitting it's particles as though it's been fired etc. but sits still attached to the crosbow for a few seconds before leaving?

Any ideas out there?

Cheers

H.

#1
05/13/2008 (12:48 pm)
Take a look at the datablock for the CrossbowImage in crossbow.cs. In that datablock you'll see the states that it has. Just make a new state for a delay in the firing state.
#2
05/14/2008 (3:50 pm)
...right... Cool...thanks for the advice..sounds like it could be a pretty simple fix then? Any chance of some pointers for an artist. My scripting is truly horrible. 8)
#3
05/14/2008 (6:25 pm)
Add a new state at the end:

stateName[7]                     = "Fuse";
   stateTransitionOnTimeout[7]      = "Fire";
   stateTimeoutValue[7]             = 0.6;
   stateSequence[7]                 = "FuseAnim";
   stateSound[7]                    = FuseSound;

Change the ready state to call the "Fuse" state:

// Ready to fire, just waiting for the trigger
   stateName[2]                     = "Ready";
   stateTransitionOnNoAmmo[2]       = "NoAmmo";
   stateTransitionOnTriggerDown[2]  = "Fuse";

It should wait 0.6 play the anim "FuseAnim" then call the "Fire" state.

/// not tested - disclaimer :)
#4
05/15/2008 (12:32 am)
8)
\
Cheers !! I'll give it a go !
#5
05/16/2008 (4:41 am)
Yeah, worked a treat 8)

Nice one all, thanks for the info. I'm seriously chuffed! little things eh?