Downloads containing batra.j2as

Downloads
Name Author Game Mode Rating
TSF Only: batrachianFeatured Download SyKio Test 8 Download file

File preview

/**

Terms and conditions:

Respect to zepect for the script.
Don't blame zepect for anything.
You are not allowed to blame zepect for anything.

By living on this planet you agree to the terms and conditions stated above.

**/
bool finished = false;
bool deathFix = false;
bool lightSet = false;
bool dveMolnii = false;
bool vtorajaMolnijaSet = false;
bool goDown = false;
bool sverkaet = false;
bool k2m = false;

int brightValue = 0;
int nextTime = 0;
int molnijaTime = 0;
int lightTime = 0;

void onLevelLoad() {
	for (int i = 0; i < 256; i++)
	jjPalette.color[i].setHSL(jjPalette.color[i].getHue(), jjPalette.color[i].getSat(), jjPalette.color[i].getLight() / 3);
	nextTime = (jjRandom()%(70*14))+70*7;
}

void onFunction5() {
	deathFix = true;
	p.morphTo(CHAR::FROG);
		
}

void onFunction6() {
	if(!deathFix) return;
	p.health = 0;
	switch(jjRandom() % 3) {
		case 0: jjChat("/me fell out of the treetops"); break;
		case 1: jjChat("/me fell on a broken branch"); break;
		case 2: jjChat("/me was eaten by a tiger"); break;
	}
}

void setLightning(bool isLightning) {
	if(isLightning) {
		//jjAlert("|Debug: ||MOLNIJA SVERKAET");
		for(int i=0;i<256;i++)
		jjPalette.color[i].setHSL(jjPalette.color[i].getHue(), jjPalette.color[i].getSat(), 255);
		jjPalette.apply();
		jjSamplePriority(SOUND::BILSBOSS_THUNDER);
	} else {
		jjPalette = jjBackupPalette;
		for (int i = 0; i < 256; i++)
		jjPalette.color[i].setHSL(jjPalette.color[i].getHue(), jjPalette.color[i].getSat(), jjPalette.color[i].getLight() / 3 + brightValue);
		jjPalette.apply();
	}
}

void onMain() {
		if(jjGameTicks%(70*30) == 0) {
		if(!goDown) brightValue++;
		else brightValue--;
		if(brightValue == 15 || brightValue == 0) {
			if(!goDown) goDown = true;
			else goDown = false;
		}
		setLightning(false);
	}
	if(dveMolnii && jjGameTicks > molnijaTime) {
		//2-ja molnija...
		
		if(!vtorajaMolnijaSet) {
			lightTime = jjGameTicks+(3+jjRandom()%18);
			vtorajaMolnijaSet = true;
			//jjAlert("|Debug: |2-JA MOLNIJA SET");
		}
		if(!sverkaet) {
			setLightning(true);
			sverkaet = true;
		}
		if(jjGameTicks > lightTime) {
			//jjAlert("|Debug: |KONEC 2-J MOLNII");
			sverkaet = false;
			setLightning(false);
			dveMolnii = false;
			vtorajaMolnijaSet = false;
			k2m = true;
			lightSet = false; //o5
			nextTime = jjGameTicks+(3+jjRandom()%18);
		}
	}
	if(!dveMolnii && jjGameTicks > nextTime) {
		if(!lightSet) {
			if(k2m) {
				//jjAlert("|Debug: |||poslednaja MOLNIJA SET");
				lightTime = jjGameTicks; //!
				k2m = false;
			} else {
				if(jjRandom()%2 == 0) { // 1 molnija (long)
					//jjAlert("|Debug: |1 MOLNIJA SET");
					lightTime = jjGameTicks+(11+jjRandom()%7);
				} else { // 2 molnii (short)
					//jjAlert("|Debug: |DVE MOLNII SET");
					dveMolnii = true;
					lightTime = jjGameTicks+(3+jjRandom()%18);
				}
			}
			lightSet = true;
		}
		if(!sverkaet) {
			setLightning(true);
			sverkaet = true;
		}
		if(jjGameTicks > lightTime) {
			//jjAlert("|Debug: |KONEC 1-J MOLNII");
			sverkaet = false;
			setLightning(false);
			if(!dveMolnii) nextTime = jjGameTicks+(jjRandom()%(70*14))+70*7;
			else molnijaTime = jjGameTicks+(jjRandom()%15);
			lightSet = false;
		}
	}
}