Downloads containing blgruins.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Project RejectFeatured Download Rysice Single player 8.9 Download file

File preview

array<SOUND::Sample> BeerSounds = {SOUND::COMMON_PLOOP1,SOUND::COMMON_PLOOP1,SOUND::COMMON_ITEMTRE,SOUND::COMMON_BUBBLGN1};
int collected = 0;
int snowflakeCounter = 0;
int maxSnowflakes = 0;
array<int> playxPos(32);
array<int> playyPos(32);
array<blgruins::Cutscenes> cutscenes(1);
array<CHAR::Char> chars = {CHAR::JAZZ,CHAR::SPAZ,CHAR::LORI}; 


namespace blgruins {
Cutscenes@ cutscene = cutscenes[0];
void SnowFood() {
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::LIME].curAnim];
	anim.frameCount = 1;
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP snowflake((10*54)); 
	snowflake.save(frame);
	frame.hotSpotX = -frame.width / 2;
	frame.hotSpotY = -frame.height / 2;
	jjObjectPresets[OBJECT::LIME].points = 50;
	jjObjectPresets[OBJECT::LIME].scriptedCollisions = true;
	jjObjectPresets[OBJECT::LIME].behavior = CustomPickup();
}

void BEEEEEER() {
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::TACO].curAnim];
	anim.frameCount = 1;
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP beer((10*47)); 
	beer.save(frame);
	frame.hotSpotX = -frame.width / 2;
	frame.hotSpotY = -frame.height / 2;
	jjObjectPresets[OBJECT::TACO].points = 100;
	jjObjectPresets[OBJECT::TACO].scriptedCollisions = true;
	jjObjectPresets[OBJECT::TACO].behavior = CustomPickup();
}

class CustomPickup : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::PICKUP);
		if (obj.eventID == OBJECT::LIME) {
			if (obj.var[7] != 3) {
				obj.var[7] = obj.var[7] + 1;
			}
			if (obj.var[7] == 1) {
				snowflakeCounter += 1;
			}
			jjPARTICLE@ particle = jjAddParticle(PARTICLE::ICETRAIL);
			if (particle !is null && (jjGameTicks % 5) == 0 ) {
				particle.xPos = (obj.xPos - 11) + int(jjRandom()& 22);
				particle.yPos = obj.yPos;
				particle.xSpeed = 0;
				particle.ySpeed = 0 - 0.3;
				particle.icetrail.color = (9*8) -6;
				particle.icetrail.colorDelta = -1;
				particle.icetrail.colorStop = 8*8;
			}
		}
		if (obj.eventID == OBJECT::TACO) {
		jjPARTICLE@ particle = jjAddParticle(PARTICLE::ICETRAIL);
		if (particle !is null && (jjGameTicks % 5) == 0 ) {
			particle.xPos = obj.direction >= 0? (obj.xPos - 11) : (obj.xPos + 11);
			particle.yPos = (obj.yPos - 5) + obj.var[8];
			particle.xSpeed = 0;
			particle.ySpeed = 0 - 0.3;
			particle.icetrail.color = (9*8) -9;
			particle.icetrail.colorDelta = -1;
			particle.icetrail.colorStop = 8*8;
			}
		}
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ player, int) {
		obj.behavior = BEHAVIOR::EXPLOSION2; 
		obj.scriptedCollisions = false;
		obj.frameID = 0;
		if (obj.eventID == OBJECT::LIME) {
			snowflakeCounter -= 1;
			jjSample(obj.xPos, obj.yPos, SOUND::COMMON_HIBELL, 63);
			collected += 1;
		}
		if (obj.eventID == OBJECT::TACO) {
			jjSample(obj.xPos, obj.yPos, BeerSounds[int(jjRandom() & 3)], 63);
			player.stoned += 200;
		}
		return true;
	}
}


class MultiplayerRock : jjBEHAVIORINTERFACE {
	bool onIsSolid(jjOBJ@ obj) {
		return true;
	}
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BIGOBJECT);
		for (int i = 0; i <= 32;i++) {
			jjPLAYER@ play = jjPlayers[i];
			if (play.yPos < obj.yPos + 32 && play.yPos > obj.yPos - 44) {
				if (play.xPos < obj.xPos && play.xPos > obj.xPos - 64 && play.keyRight && !jjMaskedVLine(int(obj.xPos) + 36,int(obj.yPos) - 32,32)) {
					obj.var[8] = -1;
					obj.xPos += 0.5f;
				}
				else if (play.xPos > obj.xPos && play.xPos < obj.xPos + 64 && play.keyLeft && !jjMaskedVLine(int(obj.xPos) - 32,int(obj.yPos) - 32,32)) {
				obj.var[8] = 1;
				obj.xPos -= 0.5f;
				} 
			}else obj.var[8] = 0;
		}
		if (!jjMaskedVLine(int(obj.xPos) + 44,int(obj.yPos) - 32,32,4) && !jjMaskedVLine(int(obj.xPos) - 44,int(obj.yPos) - 32,32,4)) {
			obj.xPos += obj.beSolid() * 0.5f;
		} else obj.beSolid() == 0;
		if (!jjMaskedHLine(int(obj.xPos) - 32,64,int(obj.yPos) + 10)){
		obj.yPos += 4;
		}
		//for (int i = 0; i <= 64;i++) {
			//jjDrawRectangle((obj.xPos - 32) + i, obj.yPos + 10, 1, 1, 16,SPRITE::NORMAL);
		//}
	}
}

void init() {
	SnowFood();
	BEEEEEER();
	if (jjGameConnection == GAME::ONLINE || jjGameConnection == GAME::LAN) {
		jjObjectPresets[OBJECT::BIGROCK].behavior = MultiplayerRock();
	}
}

void reInit() {
	snowflakeCounter = 0;
	collected = 0;
	cutscene.timeStamp = 0;
	cutscene.activated = false;
	cutscene.freezePlayer = false;
	cutscene.borders = false;
	for (int i = 0;i < 3;i++) {
		jjCharacters[chars[i]].canRun = true;
	}
}

void postInit() {
	maxSnowflakes = snowflakeCount2();
}

void blgMain() {
	cutscene.runnning();
}

void player(jjPLAYER@ play) {
	if (!cutscene.activated) {
	playxPos[play.playerID] = play.xPos;
	playyPos[play.playerID] = play.yPos;
	}
	if (cutscene.activated && cutscene.freezePlayer) {
	play.xPos = playxPos[play.playerID];
	play.yPos = playyPos[play.playerID];
	play.xSpeed = 0;
	play.ySpeed = -0.625;
	}
}
void playerInput(jjPLAYER@ play) {
	if (cutscene.activated) {
		play.keyLeft = play.keyRight = play.keyDown = play.keyUp = play.keyFire = play.keyJump = false;
		for (int i = 0;i < 3;i++) {
			jjCharacters[chars[i]].canRun = false;
		}
	}
}

void HUD(jjPLAYER@ player, jjCANVAS@ canvas) {
	const int xPos = 26;
	const int yPos = 50;
	int cinematicBordersSize = 0;
	if (cinematicBordersSize < jjSubscreenHeight/5) {
	cinematicBordersSize = cutscene.timeStamp;
	}
	if (cinematicBordersSize >= jjSubscreenHeight/5 && cinematicBordersSize < (cutscene.endTimeStamp - jjSubscreenHeight/5)) {
	cinematicBordersSize = jjSubscreenHeight/5;
	}
	if (cinematicBordersSize >= (cutscene.endTimeStamp - jjSubscreenHeight/5)) {
	cinematicBordersSize = (cutscene.endTimeStamp - cutscene.timeStamp);
	}
	if (!cutscene.activated) { 
	canvas.drawResizedSprite(xPos, jjResolutionWidth >= 512? yPos : yPos - 10, ANIM::PICKUPS, 50,0, 1 +((jjResolutionWidth * 0.001) -0.3) ,1 + ((jjResolutionHeight * 0.001) - 0.1),SPRITE::NORMAL);
	if (collected == maxSnowflakes) {
		canvas.drawString(xPos + 20	, yPos - 5,"|" + collected +  "/"+ maxSnowflakes , jjResolutionWidth >= 512? STRING::MEDIUM :STRING::SMALL , STRING::NORMAL);
	} else canvas.drawString(xPos + 20	, yPos - 5,collected +  "/"+ maxSnowflakes, jjResolutionWidth >= 512? STRING::MEDIUM : STRING::SMALL, STRING::NORMAL);
	} else {
		if (cutscene.borders == true) {
		canvas.drawRectangle(0, 0, jjSubscreenWidth,cinematicBordersSize,0, SPRITE::NORMAL,0);
		canvas.drawRectangle(0, jjSubscreenHeight, jjSubscreenWidth,-cinematicBordersSize,0, SPRITE::NORMAL,0);
		}
	}
	canvas.drawString(jjSubscreenWidth - 70, yPos - 5,"" + cutscene.timeStamp, jjResolutionWidth >= 512? STRING::MEDIUM :STRING::SMALL , STRING::NORMAL);
}

int snowflakeCount2() {
	int count = 0;
		for (int i = 0;i <= jjLayerWidth[4];i++) {
			for(int j = 0;j <=  jjLayerHeight[4];j++) {
				if (jjEventGet(i,j) == 155)  {
				count += 1;
			}
		}
	}
	return count;
}

class Cutscenes {
	int timeStamp,endTimeStamp,ID;
	bool borders,activated,freezePlayer;
		void runnning() {
			if (activated == true) {
			timeStamp++;
			}
			if (timeStamp > endTimeStamp) {
			for (int i = 0;i < 3;i++) {
			jjCharacters[chars[i]].canRun = true;
			}
			activated = false;
			timeStamp = 0;
			}
		}
	}
}