Downloads containing mo4a_4-1_revisited2.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Mystery of the Four... chandie Single player 6.6 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, WeaponVMega::IceCloud::Weapon(), WeaponVMega::Voranj::Weapon(), WeaponVMega::Backfire::Weapon(), null, ArcaneWeapons::FusionCannon::Weapon(), null, ArcaneWeapons::MortarLauncher::Weapon()}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "mo4a_4-1_revisited2-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "mo4a_4-1_revisited2.j2l" ///@MLLE-Generated
#include "ArcaneWeapon4.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon4.asc" ///@MLLE-Generated
#include "ArcaneWeapon9.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon9.asc" ///@MLLE-Generated
#include "WeaponVMega5.asc" ///@MLLE-Generated
#pragma require "WeaponVMega5.asc" ///@MLLE-Generated
#include "WeaponVMega8.asc" ///@MLLE-Generated
#pragma require "WeaponVMega8.asc" ///@MLLE-Generated
#include "WeaponVMega3.asc" ///@MLLE-Generated
#pragma require "WeaponVMega3.asc" ///@MLLE-Generated

int SpeedUpUntil = 0;
#include "Jazz1Enemies v05.asc"
#include "Resize v11.asc"
#include "TrueColor v13.asc"
#include "HH18savegems.asc"
bool Lever8 = false;

void onLevelLoad() {
	gem::restorePlayerGems();
	jjLevelName = ("@@@@@@@@@Central Area");

	jjObjectPresets[OBJECT::SEEKERAMMO15].behavior = Gwell();
	jjObjectPresets[OBJECT::SEEKERAMMO15].scriptedCollisions = true;
	jjObjectPresets[OBJECT::SEEKERAMMO15].playerHandling = HANDLING::SPECIAL;

	jjObjectPresets[OBJECT::SEEKERAMMO3].deactivates = false;

	Jazz1::MakeEnemy(OBJECT::SUCKER, Jazz1::Enemies::Holidaius_HandVertical).SetDirection(Jazz1::Directions::Right);
	Jazz1::MakeEnemy(OBJECT::RAVEN, Jazz1::Enemies::Holidaius_Devil).SetUsesJJ2StyleDeathAnimation(true).SetDeathSound(SOUND::BILSBOSS_THUNDER);
	Jazz1::MakeEnemy(OBJECT::FLOATSUCKER, Jazz1::Enemies::Holidaius_HandVertical).SetDirection(Jazz1::Directions::Left);

	jjObjectPresets[OBJECT::SAVEPOST].behavior = CheckpointWrapper;
	jjObjectPresets[OBJECT::SAVEPOST].deactivates = false;
	jjObjectPresets[OBJECT::GRASSPLATFORM].scriptedCollisions = true;
	jjObjectPresets[OBJECT::GRASSPLATFORM].behavior = PlatformH;

	jjObjectPresets[OBJECT::FRUITPLATFORM].scriptedCollisions = true;
	jjObjectPresets[OBJECT::FRUITPLATFORM].behavior = PlatformV;

	jjObjectPresets[OBJECT::SONICPLATFORM].scriptedCollisions = true;
	jjObjectPresets[OBJECT::SONICPLATFORM].behavior = FlyingSpring();	
	jjObjectPresets[OBJECT::SONICPLATFORM].determineCurAnim(ANIM::SPRING,6);

	jjObjectPresets[OBJECT::PINKPLATFORM].scriptedCollisions = true;
	jjObjectPresets[OBJECT::PINKPLATFORM].behavior = Gong();

	jjObjectPresets[OBJECT::CHICKENLEG].behavior = SuperCopter();
	jjObjectPresets[OBJECT::CHICKENLEG].scriptedCollisions = true;

	jjObjectPresets[OBJECT::FRIES].behavior = Key();
	jjObjectPresets[OBJECT::FRIES].scriptedCollisions = true;

	jjObjectPresets[OBJECT::AIRBOARD].behavior = Chakra();
	jjObjectPresets[OBJECT::AIRBOARD].scriptedCollisions = true;

	jjObjectPresets[OBJECT::CHIPS].behavior = Chakra2();
	jjObjectPresets[OBJECT::CHIPS].scriptedCollisions = true;

	jjObjectPresets[OBJECT::PRETZEL].behavior = Chakra3();
	jjObjectPresets[OBJECT::PRETZEL].scriptedCollisions = true;

	jjObjectPresets[OBJECT::FASTFEET].behavior = Chakra4();
	jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;

	jjObjectPresets[OBJECT::WEENIE].behavior = Chakra5();
	jjObjectPresets[OBJECT::WEENIE].scriptedCollisions = true;

	jjObjectPresets[OBJECT::FREEZEENEMIES].behavior = Chakra6();
	jjObjectPresets[OBJECT::FREEZEENEMIES].scriptedCollisions = true;

	jjObjectPresets[OBJECT::HAM].behavior = Chakra7();
	jjObjectPresets[OBJECT::HAM].scriptedCollisions = true;

	jjObjectPresets[OBJECT::STOPWATCH].behavior = Fastrun();
	jjObjectPresets[OBJECT::STOPWATCH].scriptedCollisions = true;

	jjObjectPresets[OBJECT::EVA].behavior = TimeMachine;
	jjObjectPresets[OBJECT::EVA].determineCurAnim(ANIM::FLAG, 1);
	jjObjectPresets[OBJECT::EVA].putOnGround(false);
	jjObjectPresets[OBJECT::EVA].scriptedCollisions = true;
	jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::EVA].curAnim];
	for (uint i = 0; i < tmAnim.frameCount; ++i)
		jjAnimFrames[tmAnim.firstFrame + i].coldSpotY = -44;
	for (uint i = 0; i < tmAnim.frameCount; ++i)
		jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -64;
	for (uint i = 0; i < tmAnim.frameCount; ++i)
		jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;

	jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
	jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
	jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
	jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
	for (uint i = 0; i < BAnim.frameCount; ++i)
		jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;

	jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
	jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
	jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
	jjObjectPresets[OBJECT::INVINCIBILITY].bulletHandling = HANDLING::IGNOREBULLET;
	jjObjectPresets[OBJECT::INVINCIBILITY].playerHandling = HANDLING::PLAYERBULLET;
	jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];

	for (uint i = 0; i < BeAnim.frameCount; ++i)
		jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 27;
	for (uint i = 0; i < BeAnim.frameCount; ++i)
		jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;

}

void Bonuseye(jjOBJ@ obj){
	obj.direction = -1;
	obj.behave(BEHAVIOR::PICKUP, false);
	obj.draw();
}
void Bonus(jjOBJ@ obj){
	obj.putOnGround();
	obj.direction = -1;
	obj.behave(BEHAVIOR::PICKUP, false);
	obj.draw();
}


void TimeMachine(jjOBJ@ obj){
	obj.behave(BEHAVIOR::EVA, false);
			jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);

}

bool gateopen = false, leveldone = false;

class Gong : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj){

	obj.playerHandling = HANDLING::SPECIAL;
		obj.energy = 2;
		if(obj.energy == 0)
		{obj.energy += 1;}
		jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::PINKPLATFORM].curAnim];
		anim.frameCount = 1;
		jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
		jjPIXELMAP lamp(0, 25*32, 4*32, 4*32, 5);
		lamp.save(frame);
		frame.hotSpotX = -42;
		obj.behave(BEHAVIOR::BUMP, false);
	if(obj.justHit == 0)
	{jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BRIGHTNESS, 180);}
	else 	obj.draw();
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) { 
		if(bullet.xPos > obj.xPos)
		{bullet.delete();}
	obj.bulletHandling = HANDLING::HURTBYBULLET;
		if(play !is null && bullet !is null && gateopen==true && leveldone == false)
		{jjMusicStop();
		leveldone = true;
		jjSample(p.xPos, p.yPos, SOUND::STONED_STONED);
		jjTriggers[1] = true;
		p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Temple Gate unlocked.");}

		return true; 
	}
}

class Gwell : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(p.ammo[WEAPON::SEEKER] > 1)
		{obj.delete();}
		obj.behave(BEHAVIOR::MONITOR);	
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) { 
		if(bullet !is null && play !is null)
			{obj.behave(BEHAVIOR::EXPLOSION2);
			jjAddObject(OBJECT::SEEKERAMMO3, 81*32, 38*32);
			jjAddObject(OBJECT::SEEKERAMMO3, 82*32, 38*32);
			jjAddObject(OBJECT::SEEKERAMMO3, 83*32, 38*32);
			jjAddObject(OBJECT::SEEKERAMMO3, 81*32, 39*32);			
			jjAddObject(OBJECT::SEEKERAMMO3, 82*32, 39*32);
			jjAddObject(OBJECT::SEEKERAMMO3, 83*32, 39*32);
			jjSample(p.xPos, p.yPos, SOUND::COMMON_HARP1, 1000);}
		return true;
	}
	
}

int SuperCopterOn = 0;
class SuperCopter : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {

obj.behave(BEHAVIOR::PICKUP, false);
obj.determineCurAnim(ANIM::PICKUPS, 33);
++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;

		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -8);

}

	bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ play, int force) {
		play.timerStart(240);
		p.morphTo(CHAR::JAZZ);
		SuperCopterOn= jjGameTicks + 4 * 61;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		obj.frameID = 0;
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUP1, 6000);

		return true;
	}

}

class FlyingSpring : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		float YSpeed = 22;
		obj.behave(BEHAVIOR::BUTTERFLY,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, 72);

		jjPARTICLE@ particle = jjAddParticle(PARTICLE::STAR);
		particle.snow.frame = jjRandom() & 987;
		particle.xPos = obj.xPos;
		particle.yPos = obj.yPos+14;
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ player, int) {
		player.direction = player.ySpeed = -42;
		obj.scriptedCollisions = true;
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SPRING1);
		return true;
		}
}


class Fastrun : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {

obj.behave(BEHAVIOR::PICKUP, false);
obj.determineCurAnim(ANIM::PICKUPS, 33);
++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;

		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -32);

}

	bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ play, int force) {
	play.timerStart(2100);
		SpeedUpUntil = jjGameTicks + 31 * 61;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		obj.frameID = 0;
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUP1, 6000);

		return true;
	}

}

class Key : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::FRIES].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 18*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(2);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}


class Chakra : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::AIRBOARD].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 11*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(11);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra2 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::CHIPS].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 12*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(1);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra3 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::PRETZEL].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 13*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(10);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra4 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::FASTFEET].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 14*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(8);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra5 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::WEENIE].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 15*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(9);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra6 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::FREEZEENEMIES].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 16*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		jjSwitchTrigger(12);
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra7 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::HAM].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 13*32, 1*32, 1*32, 5);
	pump.save(frame);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		gateopen = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
		p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@All artifacts collected.");
		return true;
	}
}

void PlatformH (jjOBJ@ obj) {

	switch (obj.state) {
		case STATE::START:
			obj.direction = obj.xSpeed = -2;
			obj.determineCurAnim(ANIM::GRASSPLAT, 0);   
			obj.determineCurFrame();
			obj.playerHandling = HANDLING::SPECIAL;
			obj.state = STATE::FLY;
			obj.beSolid();
		case STATE::FLY:
			obj.xPos = obj.xPos + obj.xSpeed;
			obj.beSolid();
			obj.deactivates = false;
			if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 16 : obj.xPos - 16, obj.yPos, 1)) {
				obj.direction = obj.xSpeed = -obj.xSpeed;
			}
			obj.draw();

			break;

	}
}



void PlatformV (jjOBJ@ obj) {

	switch (obj.state) {
		case STATE::START:
			obj.direction = obj.ySpeed = -2;
			obj.determineCurAnim(ANIM::GRASSPLAT, 0);   
			obj.determineCurFrame();
			obj.playerHandling = HANDLING::SPECIAL;
			obj.state = STATE::FLY;
			obj.beSolid();
		case STATE::FLY:
			obj.yPos = obj.yPos + obj.ySpeed;
			obj.beSolid();
			obj.deactivates = false;
			if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 62 : obj.xPos - 32, obj.yPos, 1)) {
				obj.direction = obj.ySpeed = -obj.ySpeed;
			}
			obj.draw();

			break;

	}
}

void onLevelReload() {
	gem::restorePlayerGems();
	jjLocalPlayers[0].lives++;
	buyammo = false;
  	for (uint i = 0; i < 32; ++i)
	  	jjTriggers[i] = SavedTriggers[i];
}


void onMain() {
gem::deleteCollectedGems();
if(jjKey[9] && jjKey[0x51]) {
p.morphTo(CHAR::JAZZ, false); 
}
if(jjKey[9] && jjKey[0x57]) {
p.morphTo(CHAR::SPAZ, false); 
}
if(jjKey[9] && jjKey[0x45]) {
p.morphTo(CHAR::LORI, false); 
}

}

int slope = 0;


void onFunction1(jjPLAYER@ p) {
	p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@MT. EVEREST", STRING::MEDIUM);
	jjEnabledASFunctions[0] = false;}


void onFunction5(jjPLAYER@ p) {
slope = jjGameTicks + 2*61;
}
void onFunction6(jjPLAYER@ p) {
slope = 0;
}

void onFunction11(jjPLAYER@ p) {
if(jjIsTSF == true)
	jjNxt("mo4a_save5", false, true);

if(jjIsTSF == false)
	jjNxt("mo4a_save5_123", false, true);
	gem::saveGemData();
}

void onFunction10(jjPLAYER@ p) {
p.cameraUnfreeze();
}

bool doorunblocked = false;
bool buyammo = false;

void onPlayer(jjPLAYER@ p) {
	gem::trackPlayerGems(p);
	gem::upgradeHealth(p);
p.lightType = LIGHT::NONE;
if(p.coins == 0)
{p.coins += 3;}

	if(p.ammo[WEAPON::SEEKER] < 1 && p.xPos>66*32 && p.xPos<70*32 && p.yPos<44*32 && p.yPos>40*32 && jjKey[0x50] && p.gems[GEM::RED]<50 && buyammo == false)
		{p.testForGems(50, GEM::RED);}
	if(p.ammo[WEAPON::SEEKER] < 1 && p.xPos>66*32 && p.xPos<70*32 && p.yPos<44*32 && p.yPos>40*32 && jjKey[0x50] && p.gems[GEM::RED]>=50 && buyammo == false)
	{p.testForGems(50, GEM::RED);
	jjTriggers[3]=true;
	buyammo = true;}

 		if (doorunblocked == false && jjTriggers[1]==true && jjTriggers[8]==true && jjTriggers[9]==true && jjTriggers[10]==true&& jjTriggers[11]==true && jjTriggers[12]==true) {
		p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Gold Token unlocked.");
		doorunblocked = true;}

if(p.keyUp && slope > jjGameTicks){
	p.yPos = p.yPos - 4;
	p.invisibility = true;
	jjDrawSprite(p.xPos, p.yPos, p.setID, RABBIT::HPOLE, p.curFrame, p.direction, SPRITE::PLAYER);
	}
if(p.keyUp == false && slope > jjGameTicks){
	p.invisibility = false;
}
if(slope < jjGameTicks){
	p.invisibility = false;
}

	if(p.keyUp && Lever8 == false && p.xPos > 221*32 && p.xPos < 224*32 && p.yPos < 38*32 && p.yPos > 35*32)
	{jjTriggers[8] = true;
	Lever8 = true;}

	if(SuperCopterOn > jjGameTicks)
	{jjCharacters[CHAR::JAZZ].helicopterYSpeed= 0;}
	if(SuperCopterOn < jjGameTicks)
	{jjCharacters[CHAR::JAZZ].helicopterYSpeed= 1;}

if (SpeedUpUntil > jjGameTicks) {
p.keyRun = true;
if(p.keyRight)
p.xSpeed = 30;
if(p.keyLeft)
p.xSpeed = -30;
  }


}
bool budhaannounced = false;

void onFunction12(jjPLAYER@ p) {
	if(budhaannounced == false)
	{p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@TEMPLE OF BUDDHA", STRING::MEDIUM);}
p.cameraFreeze(115*32, 43*32, true, false);
budhaannounced = true;
}


bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {

    return false;
}

bool onDrawLives(jjPLAYER@ player, jjCANVAS@ canvas) {return true;}

array<bool> SavedTriggers(32, false);
//Extendable Checkpoints by VioletCLM
void CheckpointWrapper(jjOBJ@ obj) {
  if (obj.state == STATE::STOP) { //don't do anything anymore
    jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
  } else if (obj.state == STATE::DEACTIVATE) { //due to death
    obj.deactivate();
  } else {
    obj.behave(BEHAVIOR::CHECKPOINT);
	jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
    if (obj.state == STATE::DONE) { //triggered by the player hitting it
      obj.state = STATE::STOP;
      //save the current state of some properties
      for (uint i = 0; i < 32; ++i)
        SavedTriggers[i] = jjTriggers[i];

      //OPTIONAL: this loop makes checkpoints reusable, so only the most recent checkpoint you touched is ever active
      for (int i = jjObjectCount; --i > 0;) {
        jjOBJ@ obj2 = jjObjects[i];
        if (obj2.eventID == OBJECT::CHECKPOINT && i != obj.objectID && obj2.isActive) {
          obj2.state = STATE::SLEEP;
          obj2.var[0] = 0;
        }
      }
    }
  }
}


jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
class Sign {
	private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
	private string text;
	private uint widthOfText;
	Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
	Sign(int xTile, int yTile, const string &in t) {
		xPos = xTile * 32; //Since this is a constant operation, it could strictly be performed in the draw method instead of the constructor, but this way involves fewer multiplication instructions
		yPos = yTile * 32; //
		text = t;
		SignTextAppearance.newline = STRING::SPECIALSIGN; //Causes the drawString method to interpret instances of the \n character as signals to drop down to a new line, similar to the special effect of the @ character in the STRING::SPIN appearance.
		SignTextAppearance.spacing = -2; //int jjTEXTAPPEARANCE::spacing is new in 5.2, and this particular value is equivalent to prefixing the string with "ยง2". Make sure to check out bool jjTEXTAPPEARANCE::monospace too, though it didn't end up getting used in this level.
		widthOfText = jjGetStringWidth(text, STRING::SMALL, SignTextAppearance); //Used for determining how large of a dark rectangle should be drawn behind the text. A matching heightOfText value could of course be generated by counting the number of newline characters--for example, "heightOfText = text.split("\n").length * 20;"--but here the rectangles are constant height instead to limit the temptation to ramble on and on.
	}
	void draw(jjCANVAS@ layer, uint8 textIntensity) const { //Because this method will be called from an onDraw method, it's important to have a jjCANVAS@ passed among the arguments.
		layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
		layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
	}
}
const array<Sign> Signs = { 
	Sign(53, 41, "Demons are\ngone for good."),
	Sign(168, 7, "There will always be obstacles\nin your path..."),
	Sign(7, 66, "It's been a tough ride.\nNow let's go back."),
	Sign(49, 61, "Demons are\ngone for good."),
	Sign(68, 40, "Press P if you'd like to\nbuy Gravity Well for 50 Gems."),
	Sign(118, 50, "You have a kind heart, stranger.\nThank you for saving our lands."),
};

void onDrawLayer3(jjPLAYER@, jjCANVAS@ layer) { 
	if(jjKey[0x54]){
	const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50); 
	for (uint signID = 0; signID < Signs.length; ++signID) 
		Signs[signID].draw(layer, textIntensity);
}
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}