Downloads containing saldr3.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Devan's Revenge (Intro)Featured Download sAlAmAnDeR Single player 9.6 Download file

File preview

#include "SaLLiB-v2.0.asc"
#include "saldr-common.asc"

void onLevelLoad() {
	jjObjectPresets[OBJECT::DEMON].determineCurAnim(ANIM::DEMON,0);
	jjObjectPresets[OBJECT::DEMON].determineCurFrame();
	jjObjectPresets[OBJECT::BILSY].determineCurAnim(ANIM::BILSBOSS,4);
	jjObjectPresets[OBJECT::BILSY].determineCurFrame();
	jjObjectPresets[OBJECT::DEVILDEVAN].determineCurAnim(ANIM::DEVILDEVAN,5);
	jjObjectPresets[OBJECT::DEVILDEVAN].determineCurFrame();
	jjObjectPresets[OBJECT::RAVEN].determineCurAnim(ANIM::RAVEN,0);
	jjObjectPresets[OBJECT::RAVEN].determineCurFrame();
	jjObjectPresets[OBJECT::FISH].determineCurAnim(ANIM::BIRD3D,0);
	jjObjectPresets[OBJECT::FISH].determineCurFrame();
}

void onLevelBegin() {
	for(uint i = 0; i < 49; i++)
		DemonNPC(10*32+16+24*i,55*32).direction = -1;
	for(uint i = 0; i < 13; i++)
		BilsyNPC(10*32+16+96*i,54*32).direction = -1;
	for(uint i = 0; i < 18; i++) {
		RavenNPC(10*32+16+64*i,49*32).direction = -1;
		RavenNPC(10*32-16+64*i,47*32).direction = -1;
		RavenNPC(10*32-48+64*i,45*32).direction = -1;
		RavenNPC(10*32-80+64*i,43*32).direction = -1;
	}
	@devan = DevilDevanNPC(5*32,48*32);
	
	@army = COMMON::Position(15*32, 53*32);
	
	@dragon = @RabbitNPC(CHAR::SPAZ,65*32-16,46*32-7);
	dragon.becomeMetalDragon();
	dragon.direction = -1;

	@wiceh = @RabbitNPC(CHAR::SPAZ,62*32-16,47*32-7);
	wiceh.becomeWicehy();
	
	@bossrule = @RabbitNPC(CHAR::SPAZ,68*32,47*32-7);
	bossrule.becomeBossrule();
	bossrule.direction = -1;

	@evilmike = @RabbitNPC(CHAR::SPAZ,59*32,49*32-16);
	evilmike.becomeEvilMike();
	
	/*@sal = @RabbitNPC(CHAR::SPAZ,59*32-16,49*32-16);
	sal.becomeSal();
	sal.pose();
	sal.direction = 1;*/
	
	jjLocalPlayers[0].xPos = -32;
	jjLocalPlayers[0].yPos = -32;
	jjLocalPlayers[0].xSpeed = -1;
	jjLocalPlayers[0].ySpeed = -1;
	
	CUSTOM::UI.drawAmmo = false;
	CUSTOM::UI.drawLives = false;
	CUSTOM::UI.drawScore = false;
	CUSTOM::UI.drawHealth = false;
	CUSTOM::UI.drawPlayerTimer = false;
}

RabbitNPC@ wiceh;
RabbitNPC@ dragon;
RabbitNPC@ bossrule;
RabbitNPC@ evilmike;
RabbitNPC@ sal;

CUSTOM::Object@ devan;
COMMON::Position@ army;
GAME::Dialogue@ dialogue;

COMMON::Timer@ timer = @COMMON::Timer();
INTERPOLATION::Linear@ rInter;
INTERPOLATION::Linear@ gInter;
INTERPOLATION::Linear@ bInter;

void clearChat() {
	for(int i = chat.length()-1; i > -1; i--)
		chat.removeAt(i);
}

enum State {
	PAUSE,
	INIT,
	DIALOGUEMINIONS,
	MEANWHILE,
	DIALOGUERABBITS1,
	PAUSEFORRAVENS,
	DIALOGUERABBITS2,
	SKYCOLOR,
	DIALOGUERABBITS3,
	RUNAWAY,
	PAUSEFORWAT,
	WAT,
	DONE
}

State state = PAUSE;
array<GAME::Speech@> chat();

RavenNPC@ makeRaven() {
	float xRand = 65*32-7+15*32*sin(random(0,PI)+HALF_PI);//random(61*32,70*32);
	float yRand = 44*32+15*32*cos(random(0,PI)+HALF_PI);//random(38*32,43*32);
	RavenNPC@ raven = RavenDOA(xRand,yRand);
	raven.pose();
	raven.spriteScaleX = 0.3;
	raven.spriteScaleY = 0.3;
	raven.spriteLayerZ = 7;
	raven.moveLinear(65*32-7,44*32,500);
	return raven;
}

void onMain() {
	p.ballTime = 1;
	if(state == PAUSE) {
		p.cameraFreeze(0*32,42*32,false,true);
		jjDrawString(1*32,49*32,"Back in the present...",STRING::LARGE,STRING::BOUNCE,100);
		if(jjGameTicks > 210)
			state = INIT;
	} else if(state == INIT) {
		
		chat.insertLast(GAME::Speech(devan, "|MINIONS! HEAR ME!",             					    6*32));
		chat.insertLast(GAME::Speech(devan, "|OUR ETERNAL ADVERSARIES HAVE LIVED TOO COMFORTABLY",  8*32));
		chat.insertLast(GAME::Speech(devan, "|GROWING FAT AND SLUGGISH FROM THEIR OWN PROSPERITY",  8*32));
		chat.insertLast(GAME::Speech(devan, "|BUT TODAY, ALL THAT WILL CHANGE",  					8*32));
		chat.insertLast(GAME::Speech(devan, "|FOR TODAY, WE TAKE CARROTUS!",  						8*32));
		chat.insertLast(GAME::Speech(army,  "||*CHEER*", 											3*32));
		@dialogue = @GAME::DialogueFixedDelay(chat,350);
		state = DIALOGUEMINIONS;
	} else if(state == DIALOGUEMINIONS) {
		if(!dialogue.isActive) {
			p.cameraFreeze(56*32,37*32,false,true);
			state = MEANWHILE;
			timer.start(140);
		}
	} else if(state == MEANWHILE) {
		jjDrawString(61*32,43*32,"MEANWHILE", STRING::LARGE,STRING::BOUNCE);
		if(timer.isFinished()) {
			clearChat();
			state = DIALOGUERABBITS1;
			chat.insertLast(GAME::Speech(dragon, "|its good day 2be jackrabbit", 8*32));
			chat.insertLast(GAME::Speech(wiceh,	 "|||||ya lol",				     2*32));
			chat.insertLast(GAME::Speech(dragon, "|we got lotsa carrots",		 5*32));
			chat.insertLast(GAME::Speech(wiceh,	 "|||||ya lol",				     2*32));
			chat.insertLast(GAME::Speech(dragon, "|sky is blue",				 4*32));
			chat.insertLast(GAME::Speech(wiceh,	 "|||||lol",					 1*32));
			@dialogue = @GAME::DialogueScaledDelay(chat,210);
		}
	} else if(state == DIALOGUERABBITS1) {
		if(!dialogue.isActive) {
			timer.start(280);
			state = PAUSEFORRAVENS;
		}
	} else if(state == PAUSEFORRAVENS) {
		if(timer.elapsedTime()%70 == 0)
			makeRaven();
		if(timer.isFinished()) {
			state = DIALOGUERABBITS2;
			clearChat();
			chat.insertLast(GAME::Speech(evilmike,	  "|||Hey, what's that?",			    4*32));
			chat.insertLast(GAME::Speech(bossrule,	  "carrots",	 		   				2*32));
			chat.insertLast(GAME::Speech(evilmike,	  "|||No, I mean in layer 7 you noob",  8*32));
			@dialogue = @GAME::DialogueScaledDelay(chat,210);
		}
	} else if(state == DIALOGUERABBITS2) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(!dialogue.isActive) {
			state = SKYCOLOR;
			@rInter = @INTERPOLATION::Linear(0,255,210);
			@gInter = @INTERPOLATION::Linear(0,192,210);
			timer.start(210);
			for(uint i = 0; i < 18; i++) {
				RavenNPC@ raven = @makeRaven();
				if(raven.xPos < 65*32) raven.direction = 1;
				raven.fly();
				raven.spriteScaleX = 1.5;
				raven.spriteScaleY = 1.5;
				raven.scaleDeccelerate(1.5, 0, 500,1.1);
			}
		}
	} else if(state == SKYCOLOR) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(!timer.isFinished()) {
			jjSetFadeColors(int(rInter.value(timer.elapsedTime())),int(gInter.value(timer.elapsedTime())),0);
		} else {
			jjPalette.gradient(255, 255, 128, 128, 32, 0, 176, 32);
			jjPalette.apply();
			clearChat();
			chat.insertLast(GAME::Speech(evilmike, "|||They are headed for the castle!", 6*32));
			chat.insertLast(GAME::Speech(evilmike, "|||We have to warn them! Let's go!", 6*32));
			@dialogue = @GAME::DialogueScaledDelay(chat,210);
			state = DIALOGUERABBITS3;
		}
	} else if(state == DIALOGUERABBITS3) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(!dialogue.isActive) {
			state = RUNAWAY;
			evilmike.moveLinear(54*32,49*32-16,50);
			evilmike.runAnim();
			evilmike.direction = -1;
		}
	} else if(state == RUNAWAY) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(!evilmike.isMoving()) {
			state = PAUSEFORWAT;
			timer.start(210);
		}
	} else if(state == PAUSEFORWAT) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(timer.isFinished()) {
			state = WAT;
			clearChat();
			chat.insertLast(GAME::Speech(dragon, "|...what?",	3*32));
			@dialogue = @GAME::DialogueScaledDelay(chat,140);
		}
	} else if(state == WAT) {
		if(jjGameTicks % 70 == 0) makeRaven();
		if(!dialogue.isActive) {
			jjNxt("saldr5.j2l",false,true);
			state = DONE;
		}
	}
}