/******************************************
The four main functions used by the player timer are timerStart, timerStop, timerPause, and timerResume,
all methods of jjPLAYER objects. They work pretty intuitively -- the only one that even takes any
parameters is timerStart, which requires you to choose the number of ticks the timer should last.
It is possible at any point thereafter to set the number of ticks remaining on the timer with
the jjPLAYER property timerTime. timerStart also takes an (optional) boolean parameter which,
if true, pauses the timer when it starts. Thus it is possible for the player to see how much time
they'll have to perform a task before they actually go into the relevant area and presumably
call the timerResume method.
******************************************/
void onFunction0(jjPLAYER@ play) { if (play.timerState != TIMER::STARTED) play.timerStart(15*70, false); }
void onFunction1(jjPLAYER@ play) { play.timerStop(); }
void onFunction2(jjPLAYER@ play) { play.timerPause(); }
void onFunction3(jjPLAYER@ play) { play.timerResume(); }

void onFunction4(jjPLAYER@ play, bool happy) { //the timerFunction jjPLAYER method specifies which function to call when the timer expires.
	if (happy) play.timerFunction(giveShield); //note that you can pass the function itself as the parameter, rather than a string or something
	else play.timerFunction(onPlayerTimerEnd);
	jjSample(play.xPos, play.yPos, SOUND::COMMON_UP);
}
void giveShield(jjPLAYER@ play) {
	play.shieldTime = 5*70; //70 ticks per second, so: five seconds long
	play.shieldType = (jjRandom()&3) + 1; //1, 2, 3, or 4
}
void onPlayerTimerEnd(jjPLAYER@ play) { //This is the default function called when a timer expires.
	play.kill();
}

void onFunction5(jjPLAYER@ play, bool persist) {
	play.timerPersists = persist;
}