Downloads containing BLGruins2.j2as

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

File preview

const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
#include "MLLE-Include-1.5.asc" ///@MLLE-Generated
#pragma require "BLGruins2-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "BLGruins2.j2l" ///@MLLE-Generated
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;

void SnowFood() {
	jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::LIME].curAnim];
	anim.frameCount = 1;
	jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
	jjPIXELMAP snowflake((10*46)); 
	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) {
		anim2(obj,0,5,3);
		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 onLevelLoad() {
	SnowFood();
	BEEEEEER();
	if (jjGameConnection == GAME::ONLINE || jjGameConnection == GAME::LAN) {
		jjObjectPresets[OBJECT::BIGROCK].behavior = MultiplayerRock();
	}
	jjUseLayer8Speeds = true;
	jjTexturedBGFadePositionY = 0.5;
}

void onLevelReload() {
	snowflakeCounter = 0;
	collected = 0;
}

void onMain() {
	if (jjGameTicks == 1) {
		maxSnowflakes = snowflakeCount2();
	}
}
bool onDrawScore(jjPLAYER@ player, jjCANVAS@ canvas) {
	int xPos = 26; //it is easier to work like this and positionate because i'm lazy
	int yPos = 50;
	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);
	return false;
}

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


void anim2(jjOBJ@ obj ,int min,int max,int ms) {
	if (obj.var[9] == 0) {
		if (jjGameTicks % ms == 0) {
			obj.var[8] = obj.var[8] + 1;
		}
		if (obj.var[8] == max) {
			obj.var[9] = 1;
		}
	}
	else if (obj.var[9] == 1) {
		if (jjGameTicks % ms == 0) {
		obj.var[8] = obj.var[8]- 1;
		}
		if (obj.var[8] == min) {
		obj.var[9] = 0;
		}
	}
}
void onDrawLayer5(jjPLAYER@ p, jjCANVAS@ canvas) {
        canvas.drawString(823*7, 44*13-80, "||||DAT",STRING::MEDIUM);
        canvas.drawString(823*7, 44*14-80, "||||MOLE",STRING::SMALL);
}