Downloads containing ab25btl27.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Anniversary Bash 25 Battle Jazz2Online Battle N/A Download file

File preview

#pragma require "beer.j2a"
#pragma require "HH17_Null.wav"

/*** This script is based around earlier stuff by Naps and PurpleJazz ***/

int id;
uint drunk = 0;
uint elapsed = 0;

array<SOUND::Sample> BeerSounds = {SOUND::COMMON_PLOOP1,SOUND::COMMON_PLOOP1,SOUND::COMMON_ITEMTRE,SOUND::COMMON_BUBBLGN1};
array<bool> drinking(4, false);

void BEEEEEER() {
	jjAnimations[jjObjectPresets[OBJECT::TACO].curAnim] = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]].load(0, "beer.j2a")];
	jjObjectPresets[OBJECT::TACO].scriptedCollisions = true;
	jjObjectPresets[OBJECT::TACO].behavior = CustomPickup();
}

class CustomPickup : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::PICKUP);
			if (obj.eventID == OBJECT::TACO) {
			anim2(obj,0,5,3);
			jjPARTICLE@ particle = jjAddParticle(PARTICLE::ICETRAIL);
				if (particle !is null && (jjGameTicks % 5) == 0 ) {
				particle.xPos = obj.direction >= 0? (obj.xPos - 6) : (obj.xPos + 6);
				particle.yPos = (obj.yPos - 1) + obj.var[8];
				particle.xSpeed = 0;
				particle.ySpeed = 0 - 0.3;
				particle.icetrail.color = (9*8) -9;
				particle.icetrail.colorDelta = -1;
				particle.icetrail.colorStop = 8*8;
			}
		}
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ play, int) {
	obj.behavior = BEHAVIOR::EXPLOSION2;
	obj.scriptedCollisions = false;
	obj.frameID = 0;
		if (obj.eventID == OBJECT::TACO && play.shieldType == 0) {
		jjSample(obj.xPos, obj.yPos, BeerSounds[int(jjRandom() & 3)], 63);
		play.stoned += 200;
		}
	return true;
	}
}

void anim2(jjOBJ@ obj ,int min,int max,int ms) {
	if (obj.var[9] == 0) {
		if (jjGameTicks % ms == 0) {
			obj.var[8] = obj.var[8] + 1;
			}
			if (obj.var[8] == max) {
			obj.var[9] = 1;
			}
		}
	else if (obj.var[9] == 1) {
		if (jjGameTicks % ms == 0) {
		obj.var[8] = obj.var[8]- 1;
		}
		if (obj.var[8] == min) {
		obj.var[9] = 0;
		}
	}
}

void onLevelLoad() {
	BEEEEEER();
	jjSampleLoad(SOUND::RUSH_RUSH, "HH17_Null.wav");
	jjDelayGeneratedCrateOrigins = true;
	jjUseLayer8Speeds = true;
	jjTexturedBGTexture = TEXTURE::XARGON;
	jjTexturedBGFadePositionY = 0.60;
	jjSetWaterGradient();
	jjWaterChangeSpeed = 0;
	jjLayers[5].rotationRadiusMultiplier = 0;
	jjLayers[2].rotationRadiusMultiplier = 0;
}

void onLevelBegin() {
	jjSugarRushAllowed = true;
}

void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ screen) {
	jjSetWaterLevel(32*60, true);
	jjWaterLighting = (WATERLIGHT::GLOBAL);
}

bool onDrawHealth(jjPLAYER@ play, jjCANVAS@ canvas) {
	if (drunk > 0 && drunk < 420) {
        canvas.drawSprite(jjSubscreenWidth-12, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-28, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-44, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-60, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
		canvas.drawSprite(jjSubscreenWidth-76, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
        }
		
	if (drunk > 420 && drunk < 840) {
		canvas.drawSprite(jjSubscreenWidth-12, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-28, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-44, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-60, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
		}
		
	if (drunk > 840 && drunk < 1260) {
		canvas.drawSprite(jjSubscreenWidth-12, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-28, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-44, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
		}
		
	if (drunk > 1260 && drunk < 1680) {
		canvas.drawSprite(jjSubscreenWidth-12, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41); canvas.drawSprite(jjSubscreenWidth-28, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
		}
		
	if (drunk > 1680 && drunk < 2100) {
		canvas.drawSprite(jjSubscreenWidth-12, jjSubscreenHeight-444, ANIM::AMMO, 8, 3, 0, SPRITE::SINGLEHUE, 41);
		}
		
	return false;
}

void onMain() {
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
	jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
}

void onPlayer(jjPLAYER@ play) {
	if (play.stoned > 0) {
		play.fastfire = 6;
		jjWeapons[WEAPON::SEEKER].style = WEAPON::NORMAL;
		jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
		}
		
	if (play.stoned == 200 && play.shieldType == 0) {
		play.shieldTime = 0;
		play.fastfire = 35;
		play.startSugarRush(200);
		jjMusicResume();
		jjWeapons[WEAPON::SEEKER].style = WEAPON::NORMAL;
		jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
		}
		
	if (play.stoned == 0) {
		play.fastfire = 35;
		jjWeapons[WEAPON::SEEKER].style = WEAPON::MISSILE;
		jjWeapons[WEAPON::RF].style = WEAPON::MISSILE;
		}
		
	if (play.shieldType == SHIELD::WATER) {
		jjWeapons[WEAPON::SEEKER].style = WEAPON::MISSILE;
		jjWeapons[WEAPON::RF].style = WEAPON::MISSILE;
		}
		
	if (play.yPos > jjWaterLevel) {
		switch(play.shieldType) {
			case 0: drunk++; play.shieldTime = 0; play.shieldType = 0; break;
			case 1: drunk++; play.shieldTime = 0; play.shieldType = 0; break;
 			case 2: drunk = 0; break;
			case 3: drunk++; play.shieldTime = 0; play.shieldType = 0; break;
			case 4: drunk++; play.shieldTime = 0; play.shieldType = 0; break;
			}
		}
	else if (play.yPos < jjWaterLevel) {
		drunk = 0;
		drinking[play.localPlayerID] = false;
		elapsed = 0;
		}
		
	jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
		if (particle !is null) {
			switch(drunk) {
				case 1750: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||5"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				case 1820: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||4"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				case 1890: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||3"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				case 1960: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||2"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				case 2030: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||1"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				case 2100: particle.xPos = play.xPos; particle.yPos = play.yPos; particle.string.text = "||||0"; particle.ySpeed = -0.05; jjSample(play.xPos, play.yPos, SOUND::AMMO_BLUB1); break;
				}
			}
			
		if (drunk >= 2100) drinking[play.localPlayerID] = true;
		else drinking[play.localPlayerID] = false;
		
		if (drinking[play.localPlayerID] == true) elapsed++;
		else elapsed = 0;
		
		if (elapsed % 70 == 0 && drinking[play.localPlayerID] == true) {
			play.stoned += 70;
			play.startSugarRush(70);
			jjMusicResume();
			jjWeapons[WEAPON::SEEKER].style = WEAPON::NORMAL;
			jjWeapons[WEAPON::RF].style = WEAPON::NORMAL;
			}
		else
		
		if (drunk > 0 && jjEventGet(play.xPos/32, play.yPos/32) == OBJECT::BUBBLER || jjEventGet(play.xPos/32, (play.yPos + 32)/32) == OBJECT::BUBBLER || jjEventGet(play.xPos/32, (play.yPos + 64)/32) == OBJECT::BUBBLER || jjEventGet(play.xPos/32, (play.yPos + 96)/32) == OBJECT::BUBBLER) {
			drunk = 1;
			}
			
		if (play.health == 0) {
			drunk = 0;
			elapsed = 0;
			}
}