Downloads containing mlperc.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Percolator cooba Capture the flag N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "Top3.j2t" ///@MLLE-Generated
#pragma require "mlperc.j2l" ///@MLLE-Generated

#pragma offer "SExmas.j2a"

/*******************************
A 2019 Mystic Legends Release!
http://www.mysticlegends.org
/******************************/

const int WATER_HIGH = 1228;
const int WATER_LOW  = 1582;

const uint16 COFFEE_TINT_COLOR = 183;

class Imitation : jjBEHAVIORINTERFACE {
	private uint8 eventID;
	private jjBEHAVIOR behavior;
	Imitation(uint8 realEventID, uint8 fakeEventID) {
		jjOBJ@ obj = jjObjectPresets[realEventID];
		eventID = obj.eventID;
		behavior = obj.behavior;
		obj.eventID = fakeEventID;
		obj.behavior = this;
	}
	void onBehave(jjOBJ@ obj) override {
		if (obj.state == STATE::DEACTIVATE)
			obj.eventID = eventID;
		obj.behave(behavior, false);
		
		int frame = obj.objectID * 8 + jjGameTicks;
		frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;		
		if (obj.ySpeed == 0) {
			jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction, obj.yPos > jjWaterLevel? SPRITE::TINTED : SPRITE::NORMAL, COFFEE_TINT_COLOR);
		}
		else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction, obj.yPos > jjWaterLevel? SPRITE::TINTED : SPRITE::NORMAL, COFFEE_TINT_COLOR);
	}
}

void DrownedPickup(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::PICKUP, false);
	
	int frame = obj.objectID * 8 + jjGameTicks;
	frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;		
	if (obj.ySpeed == 0) {
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction, obj.yPos > jjWaterLevel? SPRITE::TINTED : SPRITE::NORMAL, COFFEE_TINT_COLOR);
	}
	else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos + jjSin(frame)*4, obj.curFrame, obj.direction, obj.yPos > jjWaterLevel? SPRITE::TINTED : SPRITE::NORMAL, COFFEE_TINT_COLOR);
}

void onLevelLoad() {
	//jjSetWaterLevel(WATERLEVEL, true);
	jjSetWaterGradient(138,106,70, 79,61,40);
	
	Imitation(OBJECT::TACO, OBJECT::MILK);
	uint src = jjAnimSets[ANIM::CUSTOM[255]].load(0, "SExmas.j2a");
	uint dest = jjAnimSets[ANIM::PICKUPS];
	for (int i = 0; i < 95; i++) {
		const jjANIMATION@ anim = jjAnimations[src + i];
		if (anim.frameCount != 0)
			jjAnimations[dest + i] = anim;
	}
	
	jjObjectPresets[OBJECT::BOUNCERAMMO3].behavior =
	jjObjectPresets[OBJECT::ICEAMMO3].behavior =
	jjObjectPresets[OBJECT::SEEKERAMMO3].behavior =
	jjObjectPresets[OBJECT::TOASTERAMMO3].behavior =
	jjObjectPresets[OBJECT::GUN8AMMO3].behavior =
	jjObjectPresets[OBJECT::GUN9AMMO3].behavior =
	jjObjectPresets[OBJECT::CARROT].behavior =
	jjObjectPresets[OBJECT::FULLENERGY].behavior = DrownedPickup;
	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
}

void onPlayer(jjPLAYER@ play) {
	if (play.food > 0) play.food = 0;
	
	if (!play.isSpectating ) {
		if (play.xPos > 45*32 && play.xPos < 117*32) {
			jjSetWaterLevel(WATER_LOW, true);
		}
		else {
			jjSetWaterLevel(WATER_HIGH, true);
		}
	} else {
		if (play.cameraX > 40*32 && play.cameraX < 107*32) {
			jjSetWaterLevel(WATER_LOW, true);
		}
		else {
			jjSetWaterLevel(WATER_HIGH, true);
		}
	}
}

void onMain() {
	jjLayers[1].yOffset = jjWaterLevel * -1;
	jjWaterLayer = 8;
}