Downloads containing mlKnight5.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Zeno cooba Battle 7.5 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, se::EnergyBlastMLLEWrapper(), se::FireworkMLLEWrapper(), null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.7w.asc" ///@MLLE-Generated
#pragma require "mlKnight5.j2l" ///@MLLE-Generated
#include "SEfirework-mlle.asc" ///@MLLE-Generated
#pragma require "SEfirework-mlle.asc" ///@MLLE-Generated
#include "SEenergyblast-mlle.asc" ///@MLLE-Generated
#pragma require "SEenergyblast-mlle.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -battle ///@MLLE-Generated

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

void onLevelReload() {
	MLLE::SpawnOffgridsLocal();
	MLLE::ReapplyPalette();
}

void onMain() {
	jjTexturedBGFadePositionX = jjSin(jjGameTicks << 1) / 48 + .5;
	jjTexturedBGFadePositionY = jjCos(jjGameTicks << 1) / 48 + .5;
	
	jjLayers[1].hasTiles = jjLayers[2].hasTiles = jjLayers[3].hasTiles = !jjLowDetail;
}

void onLevelLoad() {
	jjOBJ@ o = jjObjects[jjAddObject(OBJECT::PINKPLATFORM, 50*32 - 16, 57*32 + 16)];
	o.state = STATE::ACTION;
	o.var[1] = 2;
	o.var[2] = 24;
	o.frameID = 0;
	o.determineCurFrame();
	o.var[0] = 1;
	o.var[5] = o.var[1];
	o.counter = jjGameTicks;
	o.var[4] = jjGameTicks*o.var[1]+o.var[0];
	o.noHit = 1;
	
	jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = SPRITE::FLIPNONE;
	jjObjectPresets[OBJECT::ICEPOWERUP].direction = SPRITE::FLIPNONE;
	jjObjectPresets[OBJECT::RFPOWERUP].direction = SPRITE::FLIPHV;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = SPRITE::FLIPH;
	
	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
	
	//thanks Violet
    array<uint8> recolor(256);
    for (uint i = 15; i < 88; ++i) //don't change most sprite colors
        recolor[i] = i;
    for (uint i = 88; i < 96; ++i) //purple to violet
        recolor[i] = i + 120;
    for (uint i = 32; i < 40; ++i) //blue to also violet
        recolor[i] = i + 176;
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::AMMO] + 63]); //bullet
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::AMMO] + 61]); //pickup
    recolorAnimation(recolor, jjAnimations[jjAnimSets[ANIM::PICKUPS] + 66]); //monitor
	
	//jjObjectPresets[OBJECT::ELECTROBULLET].counter = 48;
	
	//jjObjectPresets[OBJECT::TNT].behavior = PersonalTeleporter();
	
	//jjAnimations[jjAnimSets[ANIM::PICKUPS].firstAnim + 84].frameCount = 18;	
	//for (uint i = 0; i < 18; i++) {
		//jjANIMFRAME@ frame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::PICKUPS].firstAnim + 84] + i];
		//jjPIXELMAP(32+i*32, 0, 32, 32, 4).save(frame);
		//frame.hotSpotX = -frame.width/2;
		//frame.hotSpotY = -frame.height + 14;
		//jjTileSet(4, 1+i, 0, 0);
	//}
	//jjAnimations[jjAnimSets[ANIM::AMMO].firstAnim + 59] = jjAnimations[jjAnimSets[ANIM::PICKUPS].firstAnim + 84];
	
	//jjSampleLoad(SOUND::COMMON_COIN, "HH17_Null.wav");
}

void recolorAnimation(const array<uint8>& recolor, jjANIMATION@ anim) {
    for (uint i = 0; i < anim.frameCount; ++i) {
        jjANIMFRAME@ frame = jjAnimFrames[anim + i];
        jjPIXELMAP(frame).recolor(recolor).save(frame);
    }
}

//too elaborate?

//class PersonalTeleporter : jjBEHAVIORINTERFACE {
	//void onBehave(jjOBJ@ obj) {
		//jjLocalPlayers[0].coins = 1;
		//if (jjLocalPlayers[0].testForCoins(1)) {
			//jjLocalPlayers[0].warpToTile(54, 49);
		//}
		//obj.delete();
	//}
	//void onDraw(jjOBJ@ obj) {
		//do nothing
	//}
	//bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		//return true;
		//do nothing
	//}
//}

void onPlayer(jjPLAYER@ play) {
	
	//4.0 ahh code :skull:	
	//if (play.coins > 0) {
		//play.ammo[WEAPON::TNT] = 1;
		//play.coins = 0;
		//jjSample(play.xPos, play.yPos, SOUND::COMMON_PICKUP1, 63, 17500);
	//}
	
	if (play.fly == FLIGHT::AIRBOARD && play.timerState == TIMER::STOPPED) play.timerStart(12*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;
	jjSample(play.xPos, play.yPos, SOUND::COMMON_SWISH3, 32);
}

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 onDrawLayer4(jjPLAYER@ player, jjCANVAS@ canvas) {
	canvas.drawTile(72*32, 51*32 + 16, 705);
	canvas.drawTile(72*32, 52*32 + 16, 727);
	
	canvas.drawTile(63*32, 81*32 - 18, 4 + TILE::ANIMATED);
	canvas.drawTile(85*32, 81*32 - 18, 5 + TILE::ANIMATED);
}

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

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

void onLevelBegin() {
	MLLE::SpawnOffgrids();
}