Downloads containing mo4a_4-1.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-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "mo4a_4-1.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 Lever4 = false, Lever15 = false, Lever16 = false;
int exit = 0;

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);
	Jazz1::MakeEnemy(OBJECT::HATTER, Jazz1::Enemies::Megairbase_Doofusguard).SetUsesJJ2StyleDeathAnimation(true).SetBulletFireSound(SOUND::INTRO_SHOTGRN).SetBulletExplosionSound(SOUND::COMMON_GUNSM1);

	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 = Air();
	jjObjectPresets[OBJECT::FRUITPLATFORM].deactivates = false;	
	jjObjectPresets[OBJECT::FRUITPLATFORM].state = STATE::FLOAT;	

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

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

	jjObjectPresets[OBJECT::FASTFEET].behavior = SuperCopter();
	jjObjectPresets[OBJECT::FASTFEET].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::CHICKENLEG].behavior = Chakra4();
	jjObjectPresets[OBJECT::CHICKENLEG].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::SILVERCOIN].behavior = PlatinCoin();
	jjObjectPresets[OBJECT::SILVERCOIN].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;
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::ORANGE].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP fruit(0, 19*32, 1*32, 1*32, 5);
	fruit.save(frame);
}

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();
}

bool copterfloat = false;

class Air : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BURNING, false);
		obj.determineCurAnim(ANIM::AMMO,3);
		obj.deactivates = false;
		obj.determineCurFrame();
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*3 + 5)*2 + obj.yOrg;
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::TRANSLUCENTSINGLEHUE, 64);
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) { 
		if(bullet is null)
			{copterfloat = true;}
		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;
	}
	
}

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

}

bool gonghit = 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(play !is null && bullet !is null){
			if(bullet.xPos > obj.xPos)
				{bullet.delete();}
		obj.bulletHandling = HANDLING::HURTBYBULLET;
		if(gonghit == false) {
		jjSample(p.xPos, p.yPos, SOUND::PINBALL_BELL);
		p.showText("@@Once all tokens are collected@this gong will unlock the gate.");}
		gonghit = true;}

		return true; 
	}
}

class PlatinCoin : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(p.coins >= 1)
		{obj.delete();}
		obj.behave(BEHAVIOR::PICKUP, false);
		++obj.counter; 
		obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
		if(jjTriggers[1] && jjTriggers[8]==true && jjTriggers[9]==true && jjTriggers[10]==true &&jjTriggers[11]==true && jjTriggers[12]==true)
		{jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -8);}
		else jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::TRANSLUCENTPALSHIFT, -8);
}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		if(jjTriggers[1] && jjTriggers[8]==true && jjTriggers[9]==true && jjTriggers[10]==true &&jjTriggers[11]==true && jjTriggers[12]==true)
		{p.coins += 1; 
		obj.behavior = BEHAVIOR::EXPLOSION2;		
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_COIN, 1000);}
		else
		{p.showText("@@Collect all 6 artifacts first.");}

		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@ bullet, jjPLAYER@ player, int) {
		if(bullet !is null) {
		obj.causesRicochet = true;
		}
		else
		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(1800);
		SpeedUpUntil = jjGameTicks + 30 * 61;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		obj.frameID = 0;
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUP1, 6000);
		jjTriggers[14] = true;

		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) { 
		jjTriggers[2] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}


class Chakra : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[11] == true)
			{obj.delete();}
		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) { 
		jjTriggers[11] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra2 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[1] == true)
			{obj.delete();}
		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) { 
		jjTriggers[1] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra3 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[10] == true)
			{obj.delete();}
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::PRETZEL].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 17*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) { 
		jjTriggers[10] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra4 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[8] == true)
			{obj.delete();}
		obj.behave(BEHAVIOR::PICKUP, false);
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::CHICKENLEG].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) { 
		jjTriggers[8] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra5 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[9] == true)
			{obj.delete();}
		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) { 
		jjTriggers[9] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra6 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[12] == true)
			{obj.delete();}
		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) { 
		jjTriggers[12] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);

		return true;
	}
}

class Chakra7 : jjBEHAVIORINTERFACE {

	void onBehave(jjOBJ@ obj) {
		if(jjTriggers[12] == true)
			{obj.delete();}
		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) { 
		jjTriggers[12] = true;
		obj.behavior = BEHAVIOR::EXPLOSION2;
		jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
		p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Temple Gate unlocked.");
		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 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 onFunction0(jjPLAYER@ p) {
	p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@TEMPLE OF BUDDHA", STRING::MEDIUM);
	jjEnabledASFunctions[0] = false;}

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

void onFunction2(jjPLAYER@ p) {
	SpeedUpUntil = 0;
	p.timerStop();}

void onFunction3(jjPLAYER@ p)
{copterfloat = false;}
void onFunction4(jjPLAYER@ p)
{copterfloat = true;}

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

void onFunction11(jjPLAYER@ p) {
SuperCopterOn = 0;
jjTriggers[31] = true;
}

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

bool doorunblocked = false;
bool buyammo = false;
bool startrush = false;
bool readytorush = false;

void onPlayer(jjPLAYER@ p) {

	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::EXTRALIFE].curAnim];
	anim.frameCount = 1; 
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP pump(0, 13*32, 1*32, 1*32, 5);
	pump.save(frame);

	exit = 0;
	if(jjTriggers[1] == true)
		{exit += 1;}
	if(jjTriggers[8] == true)
		{exit += 1;}
	if(jjTriggers[9] == true)
		{exit += 1;}
	if(jjTriggers[10] == true)
		{exit += 1;}
	if(jjTriggers[11] == true)
		{exit += 1;}
	if(jjTriggers[12] == true)
		{exit += 1;}

	if(p.xPos > 114*32)
	{SpeedUpUntil = 0;}

	if(p.xPos < 114*32)
	{SuperCopterOn = 0;}

	if(p.xPos > 113*32 && p.xPos < 115*32)
	{p.timerStop();}

	gem::trackPlayerGems(p);
	gem::upgradeHealth(p);
	p.lightType = LIGHT::NONE;

	if(p.food == 100 && jjKey[0x52] == false && startrush == false)
		{p.showText("@@@@@@@@@@@@@@@@Press 'R' when you need to use Sugar Rush!", STRING::MEDIUM);
		p.startSugarRush(0);
		startrush = true;
		readytorush = true;}

	if(readytorush == true)
		{p.food = 100;}

	if(p.food == 100 && jjKey[0x52])
		{p.startSugarRush(1400);
		p.food = 0;
		readytorush = false;
		startrush = false;
	}

	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(p.ammo[WEAPON::SEEKER] >= 1 && p.xPos>66*32 && p.xPos<70*32 && p.yPos<44*32 && p.yPos>40*32 && jjKey[0x50] && buyammo == false)
		{p.showText("@@You already have the weapon.");}

 		if (doorunblocked == false && jjTriggers[1]==true && jjTriggers[8]==true && jjTriggers[9]==true && jjTriggers[10]==true&& jjTriggers[11]==true && jjTriggers[12]==true) {
		p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Token unlocked.");
		doorunblocked = true;}
if(copterfloat == true)
{jjCharacters[CHAR::JAZZ].helicopterYSpeed= -2;
jjCharacters[CHAR::LORI].helicopterYSpeed= -2;}
if(copterfloat == false)
{jjCharacters[CHAR::JAZZ].helicopterYSpeed= 1;
jjCharacters[CHAR::LORI].helicopterYSpeed= 1;}

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;
}

	for (int i = 1; i < jjObjectCount; i++) {
	jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::SILVERCOIN && p.coins >= 1) {
		o.state = STATE::KILL;
		}

	}

	if(p.keyUp && Lever15 == false && p.xPos > 25*32 && p.xPos < 28*32 && p.yPos < 30*32 && p.yPos > 27*32)
	{jjTriggers[15] = false;
	Lever15 = true;}

	if(p.keyUp && Lever16 == false && p.xPos > 14*32 && p.xPos < 17*32 && p.yPos < 30*32 && p.yPos > 27*32)
	{jjTriggers[16] = false;
	Lever16 = true;}

	if(jjTriggers[16] == true)
	{Lever16 = false;}

	if(jjTriggers[15] == true)
	{Lever15 = false;}

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

	if(p.coins<1 && p.xPos < 111*32 && p.xPos > 108*32 && p.yPos < 3*32)
	{p.testForCoins(1);}
	if(p.coins>=1 && p.xPos < 111*32 && p.xPos > 108*32 && p.yPos < 3*32)
	{jjNxt("mo4a_4-2_save", false, true);
	gem::saveGemData();}

	if(p.coins<3 && p.xPos < 116*32 && p.xPos > 113*32 && p.yPos < 52*32 && p.yPos > 47*32)
	{p.testForCoins(3);}
	if(p.coins>=3 && p.xPos < 116*32 && p.xPos > 113*32 && p.yPos < 52*32 && p.yPos > 47*32)
	{jjNxt("mo4a_4-4_save", false, true);
	gem::saveGemData();}

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

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

if (SpeedUpUntil < jjGameTicks)
		{jjTriggers[14] = false;}

	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::RFAMMO3 && p.ammo[WEAPON::RF] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::TNTAMMO3 && p.ammo[WEAPON::TNT] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::GUN9AMMO3 && p.ammo[WEAPON::GUN9] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::SEEKERPOWERUP && p.ammo[WEAPON::SEEKER] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::RFPOWERUP && p.ammo[WEAPON::RF] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::TNTPOWERUP && p.ammo[WEAPON::TNT] < 1) {
			o.state = STATE::KILL;}
	}
	for (int i = 1; i < jjObjectCount; i++) {
		jjOBJ@ o = jjObjects[i];
		if (o.isActive && o.eventID == OBJECT::GUN9POWERUP && p.ammo[WEAPON::GUN9] < 1) {
			o.state = STATE::KILL;}
	}
}


void onFunction12(jjPLAYER@ p) {
p.cameraFreeze(115*32, 43*32, true, false);
}


bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {
    canvas.drawSprite(100, 580, ANIM::PICKUPS, 0, jjGameTicks>>2, -1, SPRITE::NORMAL);
    canvas.drawString(110, 585, formatInt(exit%7, "1") + "/6", STRING::SMALL, STRING::NORMAL);
    canvas.drawSprite(20, 585, ANIM::PICKUPS, 84, jjGameTicks>>2, -1, SPRITE::PALSHIFT, -8);
    canvas.drawString(30, 585, formatInt(player.coins%4, "1") + "/3", STRING::SMALL, STRING::NORMAL);
    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(5, 64, "You're almost there for the\nlast Time Freezer. Good luck!"),
	Sign(58, 63, "Demons are in our Sacred Temple.\nThey are on to something."),
	Sign(53, 41, "Weird plants started growing in\nthese lands. I bet it's Demons' work."),
	Sign(168, 7, "There will always be obstacles\nin your path..."),
	Sign(77, 32, "Always climb up\nto proceed."),
	Sign(49, 61, "Demons are builing a fortress above the\nmountains, working on special experiments."),
	Sign(30, 50, "Collect the chakra symbols\nfrom the Chakra Temples."),
	Sign(117, 50, "Demon lies beneath this temple. Collect\n6 CHAKRA symbols to get one of the tokens."),
	Sign(68, 40, "Press P if you'd like to\nbuy Voranj for 50 Gems."),
};

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);
}