Notes:
This is setup so that a button on a USB gamepad triggers the kicker.
Replace the
sFire/
sLatch/etc parts with your actual kicking code.
Depending on how your kicker works, you may need more or less "sections".
kickTime.start in the first block is required, and
kickTimer.stop(); and
kickTimer.reset();.
Code:
// Set kicking loop to start when button 7 on gamepad is pressed and not in loop already
Watchdog.getInstance().feed();
if(gamePad.getRawButton(7) == true && kickTimer.get() == 0.0)
{
kickTimer.start();
sFire.set(true);
sLatch.set(false);
sExt.set(true);
sRet.set(false);
}
if (kickTimer.get() > 0.75 && kickTimer.get() < 1.05)
{
sFire.set(true);
sLatch.set(false);
sExt.set(false);
sRet.set(true);
}
if (kickTimer.get() > 1.05 && kickTimer.get() < 1.35)
{
sFire.set(false);
sLatch.set(true);
sExt.set(false);
sRet.set(true);
}
if (kickTimer.get() > 1.35)
{
sFire.set(false);
sLatch.set(true);
sExt.set(true);
sRet.set(false);
kickTimer.stop();
kickTimer.reset();
}