Downloads containing mlKnight7.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: PenelopeFeatured Download cooba Capture the flag 9 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, se::EnergyBlastMLLEWrapper(), ArcaneWeapons::MortarLauncher::Weapon(), null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "mlKnight7-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "mlKnight7-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ExoticusV.j2t" ///@MLLE-Generated
#pragma require "Jazz 1 Deckstar v2.0.j2t" ///@MLLE-Generated
#pragma require "mlKnight7.j2l" ///@MLLE-Generated
#include "ArcaneWeapon4.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon4.asc" ///@MLLE-Generated
#include "SEenergyblast-mlle.asc" ///@MLLE-Generated
#pragma require "SEenergyblast-mlle.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -capture ///@MLLE-Generated

#include "TrueColor v13.asc"
#pragma require "fanolint-trans-large.png"

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

void onLevelLoad() {
	jjUseLayer8Speeds = true;
	
	jjLayers[4].generateSettableTileArea();
	
	jjObjectPresets[OBJECT::FASTFEET].behavior = Invertibility();
	jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;
	jjObjectPresets[OBJECT::FASTFEET].determineCurAnim(ANIM::PICKUPS, 72);
	jjObjectPresets[OBJECT::FASTFEET].determineCurFrame();
	
	//for (int x = jjLayerWidth[4] - 1; x >= 0; --x)
		//for (int y = jjLayerHeight[4] - 1; y >= 0; --y) {
			//if (jjEventGet(x, y) == AREA::FLOATUP)
				//FloatUps.insertLast(FloatUp(x,y));
		//}
	
	jjObjectPresets[OBJECT::FROZENSPRING].behavior = YellowSpring;
	jjObjectPresets[OBJECT::FROZENSPRING].freeze = 0;
	jjObjectPresets[OBJECT::FROZENSPRING].ySpeed = -25.f;

	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
	
	TrueColor::ProcessPalette();
	TrueColor::Bitmap("fanolint-trans-large.png").saveToAnimFrames(jjAnimations[jjAnimSets[ANIM::SPIKEBOLL].allocate(array<uint>={TrueColor::NumberOfFramesPerImage})]);
}

void YellowSpring(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::SPRING, false);
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 216);
}

void onLevelBegin() {
	MLLE::SpawnOffgrids();
	//jjObjects[jjAddObject(OBJECT::BLUESPRING, 80*32, 75*32, 0, CREATOR::OBJECT, WheelSpring)].deactivates = false;
}

void onFunction0(jjPLAYER@ player) {
	jjTileSet(4, 25, 25, 0);
}

void onFunction1(jjPLAYER@ player) {
	jjTileSet(4, 135, 25, 0);	
}

void onFunction2(jjPLAYER@ player) {
	//jjHelpStrings[1] = "";
	jjEventSet(95, 11, AREA::STOPENEMY);
	jjEventSet(96, 11, AREA::STOPENEMY);
	jjEventSet(97, 11, AREA::STOPENEMY);
	jjEventSet(98, 11, AREA::STOPENEMY);
}

//I wrote all this shit and only later remembered that jjPLAYER::suckerTube() is a thing...

const uint16 LEFT_TWOWAY_1_X = 64;
const uint16 LEFT_TWOWAY_1_Y = 57;
const uint16 LEFT_TWOWAY_1a_X = 63;
const uint16 LEFT_TWOWAY_1a_Y = 57;
const uint16 LEFT_TWOWAY_2_X = 63;
const uint16 LEFT_TWOWAY_2_Y = 46;
const uint16 LEFT_TWOWAY_3_X = 59;
const uint16 LEFT_TWOWAY_3_Y = 46;

const uint16 RIGHT_TWOWAY_1_X = 96;
const uint16 RIGHT_TWOWAY_1_Y = 57;
const uint16 RIGHT_TWOWAY_2_X = 99;
const uint16 RIGHT_TWOWAY_2_Y = 57;
const uint16 RIGHT_TWOWAY_3_X = 99;
const uint16 RIGHT_TWOWAY_3_Y = 46;
const uint16 RIGHT_TWOWAY_4_X = 101;
const uint16 RIGHT_TWOWAY_4_Y = 46;

void onFunction10(jjPLAYER@ player) {
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 0, -7, -20);		//x-speed = -20
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 15, 1, 1);			//BecomeNoclip = true
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 16, 1, 0);			//NoclipOnly = false
	
	jjParameterSet(LEFT_TWOWAY_1a_X, LEFT_TWOWAY_1a_Y, 0, -7, 0);		//x-speed = 0
	jjParameterSet(LEFT_TWOWAY_1a_X, LEFT_TWOWAY_1a_Y, 7, -7, -15); 	//y-speed = 20
	
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 0, -7, -20);		//x-speed = -20
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 15, 1, 0);			//BecomeNoclip = false
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 16, 1, 1);			//NoclipOnly = true
	
	jjParameterSet(LEFT_TWOWAY_3_X, LEFT_TWOWAY_3_Y, 0, -7, -20);		//x-speed = -20
	
	jjTileSet(4, 58, 46, 26 + TILE::ANIMATED);
	jjTileSet(4, 65, 57, 26 + TILE::ANIMATED);
}

void onFunction11(jjPLAYER@ player) {
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 0, -7, 6);			//x-speed = 5
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 15, 1, 0);			//BecomeNoclip = false
	jjParameterSet(LEFT_TWOWAY_1_X, LEFT_TWOWAY_1_Y, 16, 1, 1);			//NoclipOnly = true
	
	jjParameterSet(LEFT_TWOWAY_1a_X, LEFT_TWOWAY_1a_Y, 0, -7, 5);		//x-speed = 5
	jjParameterSet(LEFT_TWOWAY_1a_X, LEFT_TWOWAY_1a_Y, 7, -7, 0); 		//y-speed = 0
	
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 0, -7, 0);			//x-speed = 0
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 7, -7, 15); 		//y-speed = 20
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 15, 1, 1);			//BecomeNoclip = true
	jjParameterSet(LEFT_TWOWAY_2_X, LEFT_TWOWAY_2_Y, 16, 1, 0);			//NoclipOnly = false
	
	jjParameterSet(LEFT_TWOWAY_3_X, LEFT_TWOWAY_3_Y, 0, -7, 20);		//x-speed = 20
	
	jjTileSet(4, 58, 46, 26 + TILE::ANIMATED + TILE::HFLIPPED);
	jjTileSet(4, 65, 57, 26 + TILE::ANIMATED + TILE::HFLIPPED);
}

void onFunction20(jjPLAYER@ player) {
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 0, -7, 20);		//x-speed = 0
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 15, 1, 1);		//BecomeNoclip = true
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 16, 1, 0);		//NoclipOnly = false
	
	jjParameterSet(RIGHT_TWOWAY_2_X, RIGHT_TWOWAY_2_Y, 0, -7, 0);		//x-speed = 0
	jjParameterSet(RIGHT_TWOWAY_2_X, RIGHT_TWOWAY_2_Y, 7, -7, -15); 	//y-speed = -15
	
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 0, -7, 20);		//x-speed = 20
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 15, 1, 0);		//BecomeNoclip = false
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 16, 1, 1);		//NoclipOnly = true
	
	jjParameterSet(RIGHT_TWOWAY_4_X, RIGHT_TWOWAY_4_Y, 0, -7, 20);		//x-speed = 20
	jjParameterSet(RIGHT_TWOWAY_4_X, RIGHT_TWOWAY_4_Y, 7, -7, 0); 		//y-speed = 0
	
	jjTileSet(4, 102, 46, 26 + TILE::ANIMATED + TILE::HFLIPPED);
	jjTileSet(4, 95, 57, 26 + TILE::ANIMATED + TILE::HFLIPPED);
}

void onFunction21(jjPLAYER@ player) {
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 0, -7, -5);		//x-speed = -5
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 7, -7, 0); 		//y-speed = 0
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 15, 1, 0);		//BecomeNoclip = false
	jjParameterSet(RIGHT_TWOWAY_1_X, RIGHT_TWOWAY_1_Y, 16, 1, 1);		//NoclipOnly = true
	
	jjParameterSet(RIGHT_TWOWAY_2_X, RIGHT_TWOWAY_2_Y, 0, -7, -15);		//x-speed = -15
	jjParameterSet(RIGHT_TWOWAY_2_X, RIGHT_TWOWAY_2_Y, 7, -7, 0); 		//y-speed = 0
	
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 0, -7, 0);		//x-speed = 0
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 7, -7, 20); 		//y-speed = 20
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 15, 1, 1);		//BecomeNoclip = true
	jjParameterSet(RIGHT_TWOWAY_3_X, RIGHT_TWOWAY_3_Y, 16, 1, 0);		//NoclipOnly = false
	
	jjParameterSet(RIGHT_TWOWAY_4_X, RIGHT_TWOWAY_4_Y, 0, -7, -20);		//x-speed = -20
	jjParameterSet(RIGHT_TWOWAY_4_X, RIGHT_TWOWAY_4_Y, 7, -7, 0); 		//y-speed = 0
	
	jjTileSet(4, 102, 46, 26 + TILE::ANIMATED);
	jjTileSet(4, 95, 57, 26 + TILE::ANIMATED);
}

void onPlayer(jjPLAYER@ play) {
	if (play.noclipMode) play.fly = FLIGHT::NONE;						//tubes disable fly c
	
	if (play.fly == FLIGHT::FLYCARROT && play.timerTime > 0) play.timerTime = 1;
	
	OldCharacter = play.charCurr;	
	if (play.timerState == TIMER::STARTED && play.timerTime <= 3*70 && play.timerTime > 0 && play.timerTime % 70 == 0) {
		jjSamplePriority(SOUND::COMMON_NOCOIN);
	}
	
	if (play.yPos >= 0) {
		int skill = jjParameterGet(uint16(play.xPos/32), uint16(play.yPos/32), -4, 2);	
		if (skill == 2 && !play.antiGrav) {
			play.ySpeed -= 8; 			//8*abs(play.ySpeed);
			play.yAcc = -32768;
			play.idle = 0;				//?????
			if (play.ySpeed < -12) {
				play.ySpeed = -12;	
			}
			if (play.ySpeed > 4) {
				play.ySpeed = 4;	
			}
		}
	}
	
	//jjDrawString(play.xPos, play.yPos - 40, "" + play.ySpeed);
}

void onDrawLayer7(jjPLAYER@ player, jjCANVAS@ layer) {
	TrueColor::DrawCanvasSprite(layer, int(jjSubscreenWidth * 0.4f), int(jjSubscreenWidth * 0.f) - 96, ANIM::SPIKEBOLL, 0, 0);
}

void WheelSpring(jjOBJ@ obj) {
	if (obj.state == STATE::START) obj.direction = 1;

	float xPos = obj.xPos;
	obj.behave(BEHAVIOR::SPRING, false);
	obj.yPos = obj.yOrg + 8;
	
	if (obj.eventID == OBJECT::BLUESPRING) obj.ySpeed = -48;
	
	if (obj.freeze == 1) obj.unfreeze(0);
	if (obj.freeze == 0) obj.xPos = xPos + 1.6f*obj.direction;
	
	if (!jjMaskedPixel(int(obj.xPos), int(obj.yPos) + 32) || jjMaskedPixel(int(obj.xPos)+16*obj.direction, int(obj.yPos-16))) {
		if (obj.direction == 1) obj.direction = -1;
		else obj.direction = 1;
	}
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos - 4, obj.curFrame, 0, obj.freeze > 0 ? SPRITE::FROZEN : SPRITE::NORMAL);
	jjDrawTile(obj.xPos - 16, obj.yPos - 8, obj.freeze > 0? 2369 + TILE::HFLIPPED : obj.direction < 0? 5 + TILE::ANIMATED : 6 + TILE::ANIMATED);
}

void onPlayerInput(jjPLAYER@ player) {
	MLLE::WeaponHook.processPlayerInput(player);
}

bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

void onMain() {
	jjLayerYOffset[6] = jjSin(jjGameTicks*2)*120;
}

const int THIRTYSECONDS = 7*70;
CHAR::Char OldCharacter;

//class FloatUp {
	//private uint x, y;
	//FloatUp(){}
	//FloatUp(uint xx, uint yy) { x = xx; y = yy; }
	//void setEvent(AREA::Area area) { jjEventSet(x, y, area); }
//}
//array<FloatUp> FloatUps;
//void SetFloatUps(bool toFloatUp) {
	//for (uint i = 0; i < FloatUps.length; ++i)
		//FloatUps[i].setEvent(toFloatUp ? AREA::FLOATUP : AREA::ACTIVATEBOSS);
//}

class Invertibility : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
		if (obj.state == STATE::FLOATFALL) obj.state = STATE::FLOAT;
	}
	void onDraw(jjOBJ@ obj) {
		int frame = obj.objectID * 8 + jjGameTicks;
		frame = (frame + int(obj.xPos) + int(obj.yPos) * 256)*16;
		
		jjDrawRotatedSpriteFromCurFrame(obj.xPos, (obj.yPos + jjSin(frame)*4) - 2, obj.curFrame, 512);
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		if (player.timerTime > 0) {
			player.timerTime += THIRTYSECONDS;
			jjSample(player.xPos, player.yPos, SOUND::COMMON_PICKUP1, 63, 17500);
		}
		else {
			player.timerStart(THIRTYSECONDS);
			jjSamplePriority(SOUND::COMMON_HOLYFLUT);
			jjSamplePriority(SOUND::COMMON_BUBBLGN1);
			
			player.morph();
			player.morphTo(OldCharacter, false);
		}
	
		player.antiGrav = true;
		jjTileSet(4, 79, 44, 0);
		jjTileSet(4, 80, 44, 0);
		jjTileSet(4, 81, 44, 0);
		
		obj.frameID = 0;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		return true;
	}
}

bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) {
      	canvas.drawString(
			jjSubscreenWidth - 75,
	      	jjSubscreenHeight - 284,
	      	"" + (play.timerTime > 0? (play.timerTime + 70) / 70 : 0),
	      	STRING::LARGE,
	      	STRING::PALSHIFT,
	      	play.timerTime > 3*70?
	      	0 :
	      	jjGameTicks % 28 > 14?
	      	216 :
	      	232
		);
		
		canvas.drawSprite(
			jjSubscreenWidth - 104,		//xpos
			jjSubscreenHeight - 276,	//ypos	
			ANIM::PICKUPS,				//setID
			72, 						//animation
			jjGameTicks / 4 % 8,		//frame
			int8(180)					//angle (wtf?)
		);
	return true;
}

void onPlayerTimerEnd(jjPLAYER@ play) {
	jjSample(play.xPos, play.yPos, SOUND::COMMON_SWISH3, 32);
	play.antiGrav = false;
	
	jjTileSet(4, 79, 44, 2563);
	jjTileSet(4, 80, 44, 2563);
	jjTileSet(4, 81, 44, 2563);
}
void onLevelReload() {
	MLLE::SpawnOffgridsLocal();
}