Downloads containing mo4a_FINALE_123.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(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "mo4a_FINALE_123.j2l" ///@MLLE-Generated

void onPlayer(jjPLAYER@ p) {
	p.direction = 1;
	p.lightType = LIGHT::NONE;
	p.idle = 100;
	p.keyRun = false;
	p.keyLeft = false;
	p.lightType = LIGHT::NONE;
	p.keyUp = false;
	p.keyDown = false;
	p.keyRight = false;


if(p.keyFire && jjGameTicks > 5*61)
jjNxt(false, true);

if(p.keyJump && jjGameTicks > 5*61)
jjNxt(false, true);

if(p.keySelect && jjGameTicks > 5*61)
jjNxt(false, true);

if(jjGameTicks > 62*61)
jjNxt(false, true);
}


bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {return true;}
bool onDrawLives(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
bool onDrawScore(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
bool onDrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas)   {return true;}

void onLevelLoad() {
	jjLevelName = ("");

	jjObjectPresets[OBJECT::WATERSHIELD].determineCurAnim(ANIM::LORI, 45);
	jjObjectPresets[OBJECT::WATERSHIELD].scriptedCollisions = true;


	jjObjectPresets[OBJECT::FIRESHIELD].determineCurAnim(ANIM::SPAZ, 31);
	jjObjectPresets[OBJECT::FIRESHIELD].scriptedCollisions = true;
	jjObjectPresets[OBJECT::FIRESHIELD].direction = -1;

	jjObjectPresets[OBJECT::PLASMASHIELD].determineCurAnim(ANIM::QUEEN, 3);
	jjObjectPresets[OBJECT::PLASMASHIELD].scriptedCollisions = true;
	jjObjectPresets[OBJECT::PLASMASHIELD].direction = -1;

	jjObjectPresets[OBJECT::BOUNCERPOWERUP].determineCurAnim(ANIM::JAZZ, 30);
	jjObjectPresets[OBJECT::BOUNCERPOWERUP].scriptedCollisions = true;
	jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;

	jjObjectPresets[OBJECT::SEEKERPOWERUP].determineCurAnim(ANIM::FLAG, 6);
	jjObjectPresets[OBJECT::SEEKERPOWERUP].scriptedCollisions = true;
	jjObjectPresets[OBJECT::SEEKERPOWERUP].direction = -1;

	jjObjectPresets[OBJECT::LASERSHIELD].determineCurAnim(RABBIT::FIRE, 0);
	jjObjectPresets[OBJECT::LASERSHIELD].scriptedCollisions = true;
	jjObjectPresets[OBJECT::LASERSHIELD].behavior = JazzShoots;
	jjObjectPresets[OBJECT::LASERSHIELD].playerHandling = HANDLING::SPECIAL;

	jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::DEVILDEVAN, 21);
	jjObjectPresets[OBJECT::TOASTERPOWERUP].scriptedCollisions = true;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = -1;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].playerHandling = HANDLING::ENEMY;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::TOASTERPOWERUP].putOnGround();	
	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].hotSpotY = -85;
	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;
	jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];

	for (uint i = 0; i < BeAnim.frameCount; ++i)
		jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 12;
	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);

}

void onFunction0(jjPLAYER@ p){
	p.xPos = 28*32;
	p.yPos = 1*32;
	p.cameraFreeze(38*32, 0*32, true, false);
}
void onFunction1(jjPLAYER@ p){
jjAddObject(OBJECT::BLASTERBULLET, 9*32, 9*32);

jjTriggers[1] = true;
}

void onFunction2(jjPLAYER@ p){
	p.cameraFreeze(0*32, 0*32, true, true);
}

void JazzShoots(jjOBJ@ obj) {
obj.behave(BEHAVIOR::MONITOR, false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, SPRITE::NORMAL);
}



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(8, 14, "Right on time! Jazz saves Ela!."),
	Sign(32, 14, "With Ela is back and Devan and the Demons are\ngone for good, it's time for Jackrabbits to live in peace.\n\n||||THE END"),
};

void onDrawLayer4(jjPLAYER@, jjCANVAS@ layer) { 
	const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50); 
	for (uint signID = 0; signID < Signs.length; ++signID) 
		Signs[signID].draw(layer, textIntensity);

}