Downloads containing ab25ctf38.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, WeaponVMega::IceCloud::Weapon(), SzmolWeaponPack::LockOnMissile::Weapon(), se::FireworkMLLEWrapper(), null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "ab25ctf38.j2l" ///@MLLE-Generated
#include "SEfirework-mlle.asc" ///@MLLE-Generated
#pragma require "SEfirework-mlle.asc" ///@MLLE-Generated
#include "lockOnMissile.asc" ///@MLLE-Generated
#pragma require "lockOnMissile.asc" ///@MLLE-Generated
#include "WeaponVMega3.asc" ///@MLLE-Generated
#pragma require "WeaponVMega3.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture -mutators="guide" ///@MLLE-Generated


jjPAL Blue;
void onLevelLoad() {
	for (uint i = 0; i < 4; ++i)
		jjAddObject(OBJECT::GRASSPLATFORM, jjLayerWidth[4] * 16, jjLayerHeight[4] * 16, i, CREATOR::LEVEL, GreatWheel);
		
	jjUseLayer8Speeds = true;
	jjTexturedBGTexture = TEXTURE::WTF;
	
	Blue = MLLE::Palette;
	array<uint8> blueRanges = {96, 111, 160, 167, 176, 240};
	for (uint start = 0; start < blueRanges.length; start += 2)
		for (uint i = blueRanges[start]; i <= blueRanges[start + 1]; ++i)
			Blue.color[i].swizzle(COLOR::BLUE, COLOR::GREEN, COLOR::RED);
			
	jjObjectPresets[OBJECT::SILVERCOIN].scriptedCollisions = true;
	jjObjectPresets[OBJECT::SILVERCOIN].behavior = One();
	
	jjObjectPresets[OBJECT::CARROT].behavior = MoveRight;
	jjObjectPresets[OBJECT::BANANA].behavior = LeafMaker;
	jjObjectPresets[OBJECT::BANANA].playerHandling = HANDLING::PARTICLE;
	
	jjANIMFRAME@ searchlight = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::BIRD]]];
	jjPIXELMAP(700).save(searchlight);
	searchlight.hotSpotX = -16;
	searchlight.hotSpotY = -31;
	
	const array<uint16> tilesWithWrongRedColor = {
		450,451,452,453,
		460,461,462,463,
		470,471,472,473,
		653,663,
		683,684,685,686,
		778,779,
		488,489,
	};
	for (uint tileID = 0; tileID < tilesWithWrongRedColor.length; ++tileID)  {
		jjPIXELMAP waterfall(tilesWithWrongRedColor[tileID]);
		for (uint x = 0; x < 32; ++x)
			for (uint y = 0; y < 32; ++y)
				if (waterfall[x,y] == 24)
					waterfall[x,y] = 160;
		waterfall.save(tilesWithWrongRedColor[tileID], true);
	}
	
	auto layers = jjLayerOrderGet();
	
	for (uint i = 0; i < 7; ++i) {
		jjLAYER moreBuildings(jjLayers[6]);
		moreBuildings.xSpeed += i / 80.f;
		moreBuildings.ySpeed += i / 96.f;
		moreBuildings.yOffset -= i * 78;
		moreBuildings.xOffset = i * 530;
		moreBuildings.spriteMode = SPRITE::SINGLECOLOR;
		moreBuildings.spriteParam = 184 + i * 9;
		layers.insertAt(5, moreBuildings);
	}
	jjLayerHasTiles[6] = false;
	jjLayers[7].spriteMode = SPRITE::SINGLECOLOR;
	jjLayers[7].spriteParam = 179;
	
	for (uint i = 0; i < 5; ++i) {
		jjLAYER moreFog(MLLE::GetLayer("Fog"));
		moreFog.xAutoSpeed += i / 10.f;
		moreFog.yOffset -= i * 26;
		moreFog.spriteParam = 32;
		moreFog.spriteMode = SPRITE::BLEND_NORMAL;
		layers.insertAt(0, moreFog);
	}
	jjLayerOrderSet(layers);
}

array<float> LastWheelX(4);
//array<float> LastWheelY(4);
void GreatWheel(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		obj.counter = obj.creatorID << 8;
		obj.curFrame = jjAnimations[jjAnimSets[ANIM::GRASSPLAT]];
		obj.state = STATE::ROTATE;
		obj.playerHandling = HANDLING::PARTICLE;
	}
	const auto lastX = obj.xPos, lastY = obj.yPos;
	const int radius = 78 * 32 + 10;
	
	for (uint i = 0; i < radius; i += 25)
		jjDrawSpriteFromCurFrame(obj.xOrg + jjSin(obj.counter) * i, obj.yOrg + jjCos(obj.counter) * i, obj.curFrame + 1, 1, SPRITE::NORMAL,0, 5);
	jjDrawSpriteFromCurFrame(lastX, lastY, obj.curFrame);
	
	if (obj.counterEnd != 0)
		--obj.counterEnd;
	else {
		if (jjLocalPlayers[0].teamRed)
			obj.counter -= 1;
		else
			obj.counter += 1;
		if (obj.counter & 255 == 0)
			obj.counterEnd = 200;
		else if (obj.counter & 127 == 0)
			obj.counterEnd = 120;
	}
	obj.xPos = obj.xOrg + jjSin(obj.counter) * radius;
	obj.yPos = obj.yOrg + jjCos(obj.counter) * radius;
	obj.bePlatform(lastX, lastY);
	LastWheelX[obj.creatorID] = lastX;
	//LastWheelY[obj.creatorID] = lastY;
}

void onFunction0(jjPLAYER@ play, uint8 angle) {
	if (!play.noclipMode && play.testForCoins(1)) {
		play.noclipMode = true;
		switch (angle & 3) {
			case 0:
				play.xSpeed = 10;
				play.ySpeed = 0;
				play.yPos = (int(play.yPos) & ~31) + 16;
				break;
			case 1:
				play.xSpeed = 0;
				play.ySpeed = 10;
				play.xPos = (int(play.xPos) & ~31) + 16;
				break;
			case 2:
				play.xSpeed = -10;
				play.ySpeed = 0;
				play.yPos = (int(play.yPos) & ~31) + 16;
				break;
			case 3:
				play.xSpeed = 0;
				play.ySpeed = -10;
				play.xPos = (int(play.xPos) & ~31) + 16;
				break;
		}
		jjSample(play.xPos, play.yPos, SOUND::COMMON_COIN);
		play.noFire = false; //jail
		play.fly = FLIGHT::NONE; //copters
	}
}

array<bool> LaterWarp(jjLocalPlayerCount);
array<bool> OnRight(jjLocalPlayerCount, true);
const float BottomRightnessDetectionRange = (jjLayerHeight[4] - 15) * 32;
const float LevelCenter = jjLayerWidth[4] * 16;
void onPlayer(jjPLAYER@ play) {
	MLLE::WeaponHook.processPlayer(play);
	
	if (play.yPos > 256 && play.yPos < BottomRightnessDetectionRange) {
		const bool wasOnRight = OnRight[play.localPlayerID];
		OnRight[play.localPlayerID] = play.xPos > LevelCenter;
		if (jjLocalPlayerCount == 1 && wasOnRight != OnRight[play.localPlayerID]) {
			(wasOnRight ? Blue : MLLE::Palette).apply();
			jjSetFadeColors(176);
		}
	}
	
	if (play.platform != 0 && !play.keyJump) {
		const jjOBJ@ plat = jjObjects[play.platform];
		if (plat.counterEnd == 0 && plat.behavior == GreatWheel) {
			const auto platX = LastWheelX[plat.creatorID];
			if (play.xPos > platX + 5)
				play.keyLeft = true;
			else if (play.xPos < platX - 5)
				play.keyRight = true;
		}
	}
	
	if (play.flag != 0)
		play.coins = 1;
}
void onFunction1(jjPLAYER@ play) {
	if (play.warpID <= 0) {
		uint8 warpID;
		if (!LaterWarp[play.localPlayerID]) {
			LaterWarp[play.localPlayerID] = true;
			warpID = play.teamRed ? 2 : 1;
			play.showText("@@@@Tubes can only be used@if you have a coin@or a flag!");
		} else {
			warpID = 
				OnRight[play.localPlayerID] ?
					play.teamRed ?
						2 : //red player
						4 : //red jail
					play.teamRed ?
						3 : //blue jail
						1   //blue player
			;
			if (warpID >= 3) { //jail
				play.noFire = true;
				for (int i = WEAPON::BLASTER; i <= WEAPON::GUN9; ++i)
					play.powerup[i] = false;
				play.showText("@@@@You were on the other team's@side of the map, so@you're going to jail.");
			}
		}
		play.warpToID(warpID);
		play.coins = 0;
	}
}

class One : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
		obj.xPos = obj.xOrg;
		obj.yPos = obj.yOrg;
		const auto yPos = obj.yPos + ::jjSin((((obj.objectID << 3) + ::jjGameTicks) << (obj.yPos > ::jjWaterLevel ? 1 : 4)) + (int(obj.xPos) << 4)) * 4.f;
		for (int i = 0; i < jjLocalPlayerCount; ++i) {
			const jjPLAYER@ play = jjLocalPlayers[i];
			jjDrawSpriteFromCurFrame(
				obj.xPos, yPos,
				obj.curFrame, obj.direction,
				play.coins == 0 ? SPRITE::NORMAL : SPRITE::TRANSLUCENT,
				0,4,4,
				play.playerID);
		}
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bull, jjPLAYER@ play, int force) {
		if (bull is null) {
			if (play.isLocal) {
				if (play.coins != 0)
					return true;
				jjSample(play.xPos, play.yPos, SOUND::COMMON_COIN);
				play.coins = 1;
			}
			obj.scriptedCollisions = false;
			obj.playerHandling = HANDLING::EXPLOSION;
			obj.behavior = BEHAVIOR::EXPLOSION2;
		}
		return true;
	}
}

void onMain() {
	MLLE::WeaponHook.processMain();
	if (!jjLowDetail)
		for (int i = 0; i < 1024; ++i)
			if (jjParticles[i].xPos < 64)
				jjParticles[i].type = PARTICLE::INACTIVE;
}

bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	if (player.isLocal && player.coins != 0 && player.flag == 0)
		canvas.drawSprite(jjSubscreenWidth - 10, jjSubscreenHeight-10, ANIM::PICKUPS, 84, jjGameTicks >> 2);
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

void MoveRight(jjOBJ@ obj) {
	if (jjTileGet(3, int(obj.xOrg) >> 5, int(obj.yOrg) >> 5) == 0)
		obj.xPos += 16;
	obj.behavior = BEHAVIOR::PICKUP;
}
void LeafMaker(jjOBJ@ obj) {
	if (obj.counter == 0) {
		const uint random = jjRandom();
		if (!jjLowDetail) {
			jjPARTICLE@ leaf = jjAddParticle(PARTICLE::LEAF);
			if (leaf !is null) {
				leaf.xPos = obj.xPos + (random & 63) - 32;
				leaf.yPos = obj.yPos + ((random >> 6) & 63) - 32;
				leaf.xSpeed = (jjSin(jjGameTicks >> 2) - 0.5) * 8;
				leaf.ySpeed = 1.25;
				leaf.leaf.frame = (random >> 12) & 31;
				leaf.leaf.height = (random >> 17) & 7;
			}
		}
		obj.counter = (random >> 20) & 127;
	} else --obj.counter;
}

/*void onDrawLayer7(jjPLAYER@, jjCANVAS@ canvas) {
	canvas.drawRotatedSprite(208, 98, ANIM::BIRD,0,0, int(jjSin(jjGameTicks << 2) * 80), 1,11, SPRITE::TRANSLUCENTTILE);
	canvas.drawTile(192, 96, 422);
}*/