2.0
28 Oct 2013 20:00
int stamina = 0;
int staminaMax = 100; //Increase this value to have more stamina.
void onPlayer(jjPLAYER@ p) {
if (jjGameTicks%10==0 && p.xSpeed == 0) stamina++;
if (stamina < 0) stamina = 0;
if (stamina > staminaMax) stamina = staminaMax;
if (p.keyRun == true && p.keyLeft == true && p.xSpeed < 4 || p.keyRun == true && p.keyRight == true && p.xSpeed > 4) {
if (jjGameTicks%7 == 0) {
stamina--;
}
}
if (p.keyRun == false && p.keyLeft == true && p.xSpeed < 0 || p.keyRun == false && p.keyRight == true && p.xSpeed > 0) {
if (jjGameTicks%17 == 0) stamina++;
}
if (stamina < 1 && p.xSpeed > 4) p.xSpeed = 4;
if (stamina < 1 && p.xSpeed < -4) p.xSpeed = -4;
}
bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ screen) {
screen.drawString(100, 470, "STAMINA: " + stamina + "/100", STRING::SMALL, STRING::NORMAL);
return true;
}
void onLevelLoad() {
stamina = staminaMax;
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.