Downloads containing saldr2.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"

class Lizard : CUSTOM::Object {
	private int sound = 0;
	Lizard(float xPos, float yPos) {
		super(OBJECT::FISH,xPos,yPos);
		determineCurAnim(ANIM::LIZARD,4);
		determineCurFrame();
		direction = -1;
	}
	
	void behavior() { 
		if(isMoving()) {
			if(jjGameTicks % 70 == 0) {
				sound = (sound + 1) % 4;
				if(sound == 0)
					jjSamplePriority(SOUND::LIZARD_LIZ1);
				else if(sound == 1)
					jjSamplePriority(SOUND::LIZARD_LIZ2);
				else if(sound == 2)
					jjSamplePriority(SOUND::LIZARD_LIZ4);
				else if(sound == 3)
					jjSamplePriority(SOUND::LIZARD_LIZ6);
			}
			jjDrawSprite(xPos,yPos,ANIM::LIZARD,4,(jjGameTicks/7)%12,direction);
		} else
			jjDrawSprite(xPos,yPos,ANIM::LIZARD,4,5,direction);
	}
}

class Devan : CUSTOM::Object {
	Devan(float xPos, float yPos) {
		super(OBJECT::FISH, xPos, yPos);
		determineCurAnim(ANIM::DEVAN,1);
		determineCurFrame();
		direction = -1;
	}
}

CUSTOM::Object@ devan;
CUSTOM::Object@ lizard;
CUSTOM::Object@ futureDevan;
GAME::Dialogue@ dialogue;
array<GAME::Speech@> chat;
array<GAME::Speech@> chat2;
bool lizardChat = false;

enum State {
	INIT,
	PAUSE,
	LIZARDENTER,
	LIZARDCHAT,
	LIZARDEXIT,
	WARPBG,
	BLINKBG,
	DEVANWARPIN,
	DEVANCHAT,
}

State state = INIT;
COMMON::Timer timer();

void onLevelBegin() {
	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;
	//CUSTOM::Palette().colorSepia();
}

void onMain() {
	p.ballTime = 1;
	if(state == State::INIT) {
		@devan = @Devan(7*32,12*32+10);
		@lizard = @Lizard(22*32,12*32+10);
		state = PAUSE;
	} else if(state == State::PAUSE) {
		jjDrawString(5*32,7*32,"16 years ago...",STRING::LARGE,STRING::BOUNCE,100);
		if(jjGameTicks > 210) {
			lizard.moveLinear(9*32,12*32+10,210);
			state = LIZARDENTER;
		}
	} else if(state == State::LIZARDENTER) {
		if(!lizard.isMoving()) {
			state = LIZARDCHAT;
			devan.direction = 1;
			chat.insertLast(GAME::Speech(lizard, "||||Hey Boss!", 									3*32));
			chat.insertLast(GAME::Speech(lizard, "||||Watcha' Doin?",								4*32));
			chat.insertLast(GAME::Speech(devan,  "||||||||I'm pleased to announce",						7*32));
			chat.insertLast(GAME::Speech(devan,  "||||||||that I'm in the process of making...",			10*32));
			chat.insertLast(GAME::Speech(devan,  "||||||||HISTORY!!",										3*32));
			chat.insertLast(GAME::Speech(devan,  "||||||||I'm going to need you to do me a little favor.",	12*32));
			chat.insertLast(GAME::Speech(lizard, "||||Help make history with you?",					7*32));
			chat.insertLast(GAME::Speech(lizard, "||||Sure thing boss!",							5*32));
			chat.insertLast(GAME::Speech(devan,  "||||||||*whisper whisper*",								6*32));
			@dialogue = @GAME::DialogueScaledDelay(chat,210);
		}
	} else if(state == State::LIZARDCHAT) {
		if(!dialogue.isActive) {
			state = LIZARDEXIT;
			lizard.moveLinear(22*32,12*32+10,210);
			lizard.direction = 1;
		}
	} else if(state == State::LIZARDEXIT) {
		if(!lizard.isMoving()) {
			state = WARPBG;
			//jjLayerHasTiles[6] = false;
			jjTexturedBGStyle = TEXTURE::TUNNEL;
			jjTexturedBGUsed = true;
			setBackgroundTileType(1);
			GAME::FloatingString("|||||||What is this?!", devan, -2*32, -32, 210);
			timer.start(350);
		}
	} else if(state == State::WARPBG) {
		if(!timer.isFinished()) {
			float size =  1 - timer.elapsedTime() / 350.0;
			jjTexturedBGFadePositionX = ((jjSin(jjGameTicks << 1) / 2)*size + .5);
			jjTexturedBGFadePositionY = ((jjCos(jjGameTicks << 1) / 2)*size + .5);
		} else {
			state = BLINKBG;
			timer.start(70);
		}
	} else if(state == BLINKBG) {
		if(!timer.isFinished()) {
			if((timer.elapsedTime())%5 == 0) 
				setBackgroundTileType(0);
			else
				setBackgroundTileType(1);
		}
		else {
			state = DEVANWARPIN;
			jjLayerHasTiles[6] = false;
			@futureDevan = @Devan(10*32,12*32+10);
			futureDevan.warpIn();
		}
	} else if(state == State::DEVANWARPIN) {
		if(!futureDevan.isWarping()) {
			chat2.insertLast(@GAME::Speech(devan,		"||||||||What in the..",			 4*32));
			chat2.insertLast(@GAME::Speech(futureDevan, "||||||||LISTEN TO ME CAREFULLY...", 8*32));
			@dialogue = @GAME::DialogueScaledDelay(chat2,210);
			state = DEVANCHAT;
		}
	} else if(state == State::DEVANCHAT) {
		if(!dialogue.isActive) {
			jjNxt("saldr3.j2l",false,true);
		}
	}
}

void setBackgroundTileType(int tileType) {
	for(uint i = 0; i < 3; i++)
		for(uint j = 0; j < 3; j++)
			jjTileType[127+i+10*j] = tileType;
}