Downloads containing ab17btl20.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 17 Levels Jazz2Online Multiple N/A Download file

File preview

int id;
uint limitedOxygen = 0;
uint elapsed = 0;
uint8 istsfint = 0;

jjOBJ@ Vendor;

array<bool> playerDrowning(4, false);

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

void onLevelLoad() {
	jjSetWaterGradient(0, 0, 255, 0, 0, 255);
	jjWaterChangeSpeed = 0;
	jjSetWaterLevel(32*58, true);
	jjWaterLighting = (WATERLIGHT::GLOBAL);

	jjWeapons[WEAPON::SEEKER].maximum = 25;
	jjWeapons[WEAPON::GUN8].maximum = 99;

	jjObjectPresets[OBJECT::FIREBALLBULLET].special = jjObjectPresets[OBJECT::FIREBALLBULLET].determineCurAnim(ANIM::AMMO, 8);
        jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = BubbleGun;
        jjObjectPresets[OBJECT::FIREBALLBULLET].xSpeed = 2;
        jjObjectPresets[OBJECT::FIREBALLBULLET].ySpeed = 0;
        jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 105;
 
        jjObjectPresets[OBJECT::FIREBALLBULLETPU].special = jjObjectPresets[OBJECT::FIREBALLBULLETPU].determineCurAnim(ANIM::AMMO, 8);
        jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = BubbleGunPU;
        jjObjectPresets[OBJECT::FIREBALLBULLETPU].xSpeed = 2;
        jjObjectPresets[OBJECT::FIREBALLBULLETPU].ySpeed = -0.5;
        jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd = 105;
		jjObjectPresets[OBJECT::EVA].behavior = resized;
	if(jjIsTSF)
	{
    istsfint=1;
	}
}

void onLevelBegin() {
	//if (jjIsServer) jjChat("/fireball on");
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjWeapons[WEAPON::GUN8].gradualAim = false;

	for (int x = 0; x < jjLayerWidth[4]; x++) {
    	for (int y = 0; y < jjLayerHeight[4]; y++) {
		 uint16 tile = jjTileGet(4, x, y);
        if (jjEventGet(x, y) == 119) jjTileSet(4, x, y, tile ^ TILE::VFLIPPED);
    }
  }
	int light = jjAddObject(OBJECT::STEADYLIGHT,32*180,32*71);
	int light2 = jjAddObject(OBJECT::STEADYLIGHT,32*42,32*72);
	jjObjects[light].lightType = LIGHT::LASER;
	jjObjects[light].light = 64;
	jjObjects[light2].lightType = LIGHT::LASER;
	jjObjects[light2].light = 64;
		id=jjAddObject(OBJECT::EVA,32*4,32*15,5);
		@Vendor=jjObjects[id];
		Vendor.determineCurAnim(ANIM::JAZZ,36-istsfint*3);
		Vendor.frameID=0;
		Vendor.behavior=resized;
}


void onPlayer(jjPLAYER@ play) {
	p.lighting = 60;

	if (play.yPos > jjWaterLevel) {
                switch(play.shieldType) {
                        case 0: limitedOxygen++; play.shieldTime = 0; play.shieldType = 0; break;
                        case 1: limitedOxygen++; play.shieldTime = 0; play.shieldType = 0; break;
                        case 2: limitedOxygen = 0; break;
                        case 3: limitedOxygen++; play.shieldTime = 0; play.shieldType = 0; break;
                        case 4: limitedOxygen++; play.shieldTime = 0; play.shieldType = 0; break;
                }
        }
        else if (play.yPos < jjWaterLevel) {
                limitedOxygen = 0;
                playerDrowning[play.localPlayerID] = false;
                elapsed = 0;
        }
 
        jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
        if (particle !is null) {
                switch(limitedOxygen) {
                        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 (limitedOxygen >= 2100) playerDrowning[play.localPlayerID] = true;
        else playerDrowning[play.localPlayerID] = false;
       
        if (playerDrowning[play.localPlayerID] == true) elapsed++;
        else elapsed = 0;
 
        if (elapsed % 70 == 0 && playerDrowning[play.localPlayerID] == true) {
                play.hurt(1, true);
        }
        else //do nothing
 
        if (limitedOxygen > 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) {
                limitedOxygen = 1;
        }
 
        if (play.health == 0) {
                limitedOxygen = 0;
                elapsed = 0;
        }
}

void resized(jjOBJ@ obj) {
  obj.determineCurFrame();
  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 0, SPRITE::RESIZED, 48);
}

void BubbleGun(jjOBJ@ bubble) {
        if (bubble.state == STATE::START) {
                bubble.state = STATE::FLY;
                jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
        }
 
        bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
 
        if (jjMaskedPixel(bubble.xPos + bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos - bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos, bubble.yPos + bubble.ySpeed) || jjMaskedPixel(bubble.xPos, bubble.yPos - bubble.ySpeed)) {
                jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
        }
 
        bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
 
        bubble.determineCurFrame();
 
        bubble.animSpeed = 1;
        bubble.var[6] = 0;
}

void BubbleGunPU(jjOBJ@ bubble) {
        if (bubble.state == STATE::START) {
                bubble.state = STATE::FLY;
                jjSample(bubble.xPos, bubble.yPos, SOUND::COMMON_PLOP2, 0, 0);
        }
 
        bubble.behave(BEHAVIOR::WATERSHIELDBULLET);
 
        if (jjMaskedPixel(bubble.xPos + bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos - bubble.xSpeed, bubble.yPos) || jjMaskedPixel(bubble.xPos, bubble.yPos + bubble.ySpeed) || jjMaskedPixel(bubble.xPos, bubble.yPos - bubble.ySpeed)) {
                jjSample(bubble.xPos, bubble.yPos, SOUND::P2_SPLOUT, 0, 0);
        }
 
        bubble.killAnim = jjObjectPresets[OBJECT::WATERSHIELDBULLET].killAnim;
 
        jjDrawSpriteFromCurFrame(bubble.xPos, bubble.yPos, bubble.curFrame, bubble.direction, SPRITE::NEONGLOW, 2);
        bubble.determineCurFrame();
 
        bubble.animSpeed = 2;
        bubble.var[6] = 8;
}

void healPlayer() {
	if (p.health < jjMaxHealth) {
		switch(p.charCurr) 
		{
			case CHAR::JAZZ: jjSamplePriority(SOUND::JAZZSOUNDS_JUMMY); break;
			case CHAR::SPAZ: jjSamplePriority(SOUND::SPAZSOUNDS_HAPPY); break;
			default: jjSamplePriority(SOUND::COMMON_EAT2); break;
		}
	p.health = jjMaxHealth;
	p.invincibility = 5*70;
	}
}

void bonusBooth40() {
	if (p.testForCoins(40)) {
		jjSamplePriority(SOUND::COMMON_GLASS2);
		p.shieldType = 2;
		p.shieldTime = 30*70;
		p.showText("@@@@@@####There you go!@Have fun!");
		healPlayer();
	}
}

void bonusBoothText() {
	p.showText("@@@@@####Hey lad!@@I can let you play around with@my super soaker shield gun for@a moment if you pay me just 40 coins!@@I'll heal your wounds too!");
	if (p.testForCoins(40)) {};
}

void onFunction0(jjPLAYER@ p, bool offset) {
	p.antiGrav = offset;

	if (offset == true) {
		jjSamplePriority(SOUND::STEAM_STEAM);
		jjTriggers[1] = true;
	}
	else {
	jjTriggers[1] = false;
	}
}

void onFunction1() {
	jjRandom()%2;
	if (jjRandom() % 2 == 0) {
		p.offsetPosition(64,0);
		} 
	else {
		p.offsetPosition(32,32);
	}
}

void onFunction2() {
	p.warpToTile(188, 9);
}

void onFunction3() {
	     if (p.coins >= 40) bonusBooth40();
	                   else bonusBoothText();
}