Downloads containing xlmskywardl.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Skyward ShowdownFeatured Download PurpleJazz Capture the flag 9.1 Download file

File preview

#pragma require "wind1.wav"
#pragma require "SHIPHUMS.wav"
#pragma require "xlmskywardex.j2l"
#pragma require "xlmskywardex2.j2l"

bool gameIsActive() {
	return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}

bool CTFMode() {
	return (jjGameMode == GAME::CTF && jjGameCustom == GAME::NOCUSTOM) || jjGameCustom == GAME::DCTF;
}

bool otherMode() {
	return jjGameMode != GAME::CTF || jjGameCustom == GAME::TB || jjGameCustom == GAME::TLRS || jjGameCustom == GAME::DOM;
}

bool muteAmbientWind() {
	return (jjLocalPlayers[0].xPos < 22*32 && jjLocalPlayers[0].yPos < 46*32) || (jjLocalPlayers[0].xPos > 258*32 && jjLocalPlayers[0].yPos < 46*32);
}

bool isWindSound(jjOBJ@ sound) {
	return sound.xOrg >= 277*32;
}

bool isShipSound(jjOBJ@ sound) {
	return sound.xOrg <= 2*32;
}

const array<uint16> invisibleTiles = {
	75,
	102, 103,
	112, 113, 116, 117, 118, 119,
	122, 123, 126, 127, 128, 129,
	132, 133,
	142, 143,
	152, 153
};

uint delay = 0;

void onLevelLoad() {
	jjSampleLoad(SOUND::WIND_WIND2A, "wind1.wav");
	jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "SHIPHUMS.wav");
	
	jjTexturedBGFadePositionY = 0.1;
	jjUseLayer8Speeds = true;
	
	jjObjectPresets[OBJECT::LIGHTNINGSHIELD].behavior = 
	jjObjectPresets[OBJECT::RFPOWERUP].behavior = OscillatingMonitor();
	
	jjObjectPresets[OBJECT::AMBIENTSOUND].behavior = AmbientSound();
	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
	
	jjLayerXOffset[6] = 128;
	
	array<jjLAYER@> extraLayers = jjLayersFromLevel("xlmskywardex.j2l", array<uint> = {1,2,3,5,6,7}, 0);
	array<jjLAYER@> extraLayers2 = jjLayersFromLevel("xlmskywardex2.j2l", array<uint> = {1,2,3,4,5,6,7}, 0);
	jjLayerOrderSet(array<jjLAYER@> = {extraLayers[0], extraLayers[1], extraLayers2[4], extraLayers2[5], extraLayers2[6], jjLayers[3], jjLayers[1], jjLayers[4], extraLayers2[0], extraLayers2[1], extraLayers2[2], extraLayers2[3], jjLayers[2], jjLayers[5], extraLayers[2], jjLayers[6], jjLayers[7], extraLayers[3], extraLayers[4], extraLayers[5], jjLayers[8]});
	
	extraLayers[1].spriteMode = SPRITE::TRANSLUCENTCOLOR;
	extraLayers[1].spriteParam = 86;
	
	extraLayers[2].xOffset = 100;
	extraLayers[2].yOffset = 360;
	extraLayers[3].xOffset = 80;
	extraLayers[3].yOffset = 120;
	extraLayers[4].xOffset = 160;
	extraLayers[4].yOffset = 140;
	extraLayers[5].xOffset = 320;
	extraLayers[5].yOffset = 160;
	
	extraLayers2[4].xOffset = 200;
	extraLayers2[4].yOffset = -1700;
	extraLayers2[5].xOffset = 300;
	extraLayers2[5].yOffset = -1600;
	extraLayers2[6].xOffset = 400;
	extraLayers2[6].yOffset = -1500;
	
	for (uint16 i = 0; i < invisibleTiles.length(); i++) {
		jjTileType[invisibleTiles[i]] = 3; //invisible
	}
	jjTileType[1176] = 5;
}

class OscillatingMonitor : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::MONITOR);
		obj.xPos = obj.xOrg - 4;
		obj.yPos = (obj.yOrg + 2) - jjLayerYOffset[2];
		obj.direction = -1;
	}
}

class AmbientSound : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ sound) {
		sound.behave(jjLowDetail && jjGameTicks >= 2? BEHAVIOR::INACTIVE : BEHAVIOR::AMBIENTSOUND, false);
		if (jjLocalPlayers[0].health > 0) delay++;
		else delay = 0;
		
		if (jjTriggers[19] && isWindSound(sound) && delay >= 35) {
			loopSound(sound);
		}
		if (!jjTriggers[19] && isShipSound(sound) && delay >= 35) {
			loopSound(sound);
		}
	
		if ((muteAmbientWind() && isWindSound(sound)) || jjLocalPlayers[0].health == 0) {
			jjTriggers[19] = false;
			sound.xPos = sound.xOrg;
			sound.yPos = sound.yOrg;
		}
	}
}

void loopSound(jjOBJ@ sound) {
	sound.xPos = jjLocalPlayers[0].xPos;
	sound.yPos = jjLocalPlayers[0].yPos;
}

void onPlayer(jjPLAYER@ play) {
	if (play.shieldTime > 15*70) play.shieldTime = 15*70;
	
	play.lightType = LIGHT::NONE;
	
	if (play.fly == FLIGHT::AIRBOARD && play.timerState == TIMER::STOPPED) play.timerStart(20*70);
	if (play.fly == FLIGHT::NONE) play.timerStop();
  	if (play.timerState == TIMER::STARTED && play.timerTime <= 3*70 && play.timerTime > 0 && play.timerTime % 70 == 0) jjSamplePriority(SOUND::COMMON_NOCOIN);
}

void onPlayerTimerEnd(jjPLAYER@ play) { play.fly = FLIGHT::NONE; }

void onMain() {
	if (!jjLowDetail) {
		jjLayerYOffset[1] = jjCos(jjGameTicks*8)*4;
		jjLayerYOffset[2] = jjCos(jjGameTicks*8)*4;
	} else {
		jjLayerYOffset[1] = 
		jjLayerYOffset[2] = 0;
	}
	
	array<jjLAYER@> layers = jjLayerOrderGet();
	layers[0].hasTiles = layers[1].hasTiles = false;
	layers[8].xOffset = jjSin(jjGameTicks*48)*8;
	layers[9].xOffset = -jjSin(jjGameTicks*48)*8;
	layers[10].yOffset = jjCos(jjGameTicks*48)*8;
	layers[11].yOffset = -jjCos(jjGameTicks*48)*8;
}

bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) {
	if (play.fly == FLIGHT::AIRBOARD) {
      	canvas.drawString(
			jjSubscreenWidth - 75,
	      	jjSubscreenHeight - 284,
	      	"" + (play.timerTime > 0? (play.timerTime + 70) / 70 : 0),
	      	STRING::LARGE,
	      	STRING::PALSHIFT,
	      	play.timerTime > 3*70?
	      	24 :
	      	jjGameTicks % 28 > 14?
	      	-40 :
	      	-24
		);
		
		canvas.drawSprite(
			jjSubscreenWidth - 92,
			jjSubscreenHeight - 280,
			ANIM::PICKUPS,
			36, 
			jjGameTicks / 6 % 8
		);
	}
	return true;
}

void onFunction0(jjPLAYER@ play) {
	play.showText("@@@@Skyward Showdown@Created by PurpleJazz of XLM (2009-2017)@Tileset by BlurredD@np: Kevin Riepl - Skyscraper [2:01]");
}