Downloads containing LHDMv2.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Disarrayed Memories V2.5 TreyLina Capture the flag N/A Download file

File preview

void onMain() {
	jjTriggers[0] = jjLocalPlayers[0].teamRed;
	jjLayerXOffset[2] = jjLayerXOffset[2] + 0.5f;
	if (jjLayerXOffset[2] > jjLayerWidth[2] * 32)
		jjLayerXOffset[2] = jjLayerXOffset[2] - jjLayerWidth[2] * 32;
	jjSetFadeColors(0, 0, 40 + int(20 * jjSin(jjGameTicks * 4)));
}
void onLevelLoad() {
	jjObjectPresets[OBJECT::BOUNCERBULLET].behavior = bouncerBullet;
	jjObjectPresets[OBJECT::BOUNCERBULLETPU].behavior = bouncerBulletPU;
	for (int i = WEAPON::BLASTER; i <= WEAPON::GUN9; i++) {
		if (jjWeapons[i].style != WEAPON::POPCORN)
			jjWeapons[i].style = WEAPON::CAPPED;
	}
	
	jjPalette.gradient(235,215,0, 30,15,0, 208, 7);
	
	array<int> BncSprites = {23, 25};
	for (int i = 0; i < 2; i++) {
		jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + BncSprites[i]];
		for (uint j = 0; j < anim.frameCount; j++) {
			jjANIMFRAME@ frame = jjAnimFrames[anim + j];
			jjPIXELMAP sprite(frame);
			for (uint x = 0; x < sprite.width; ++x) {
				for (uint y = 0; y < sprite.height; ++y) {
					if (sprite[x,y] >= 32 && sprite[x,y] <= 39) sprite[x,y] += 40;
				}
			}
			sprite.save(frame);
		}
	}
	
	array<int> PUBncSprites = {24, 26};
	for (int i = 0; i < 2; i++) {
		jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + PUBncSprites[i]];
		for (uint j = 0; j < anim.frameCount; j++) {
			jjANIMFRAME@ frame = jjAnimFrames[anim + j];
			jjPIXELMAP sprite(frame);
			for (uint x = 0; x < sprite.width; ++x) {
				for (uint y = 0; y < sprite.height; ++y) {
					if (sprite[x,y] >= 88 && sprite[x,y] <= 94) sprite[x,y] += 120;
					else if (sprite[x,y] == 95) sprite[x,y] -= 32;
				}
			}
			sprite.save(frame);
		}
	}
 
	jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::PICKUPS] + 61];
	for (uint j = 0; j < anim.frameCount; j++) {
		jjANIMFRAME@ frame = jjAnimFrames[anim + j];
		jjPIXELMAP sprite(frame);
		for (uint x = 0; x < sprite.width; ++x) {
			for (uint y = 0; y < sprite.height; ++y) {
				if (sprite[x,y] >= 88 && sprite[x,y] <= 94) sprite[x,y] += 120;
				else if (sprite[x,y] == 95) sprite[x,y] -= 32;
			}
		}
		sprite.save(frame);
	}
}

void bouncerBullet(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::BOUNCERBULLET);
	preventBouncerFromGoingThroughWalls(obj);
}
void bouncerBulletPU(jjOBJ@ obj) {
	obj.behave(BEHAVIOR::BOUNCERBULLETPU);
	preventBouncerFromGoingThroughWalls(obj);
}
void preventBouncerFromGoingThroughWalls(jjOBJ@ obj) {
	int x = int(obj.xPos), y = int(obj.yPos);
	if (jjMaskedPixel(x, y)) {
		for (int i = 0;; i++) {
			if (!jjMaskedPixel(x - i, y)) {
				obj.xPos = x - i - 2;
				if (obj.xSpeed > 0)
					obj.xSpeed = -obj.xSpeed * 0.875;
				if (obj.xAcc > 0)
					obj.xAcc = -obj.xAcc;
				break;
			}
			if (!jjMaskedPixel(x + i, y)) {
				obj.xPos = x + i + 2;
				if (obj.xSpeed < 0)
					obj.xSpeed = -obj.xSpeed * 0.875;
				if (obj.xAcc < 0)
					obj.xAcc = -obj.xAcc;
				break;
			}
			if (!jjMaskedPixel(x, y - i)) {
				obj.yPos = y - i;
				if (obj.ySpeed > 0)
					obj.ySpeed = -obj.ySpeed * 0.875;
				break;
			}
			if (!jjMaskedPixel(x, y + i)) {
				obj.yPos = y + i;
				if (obj.ySpeed < 0)
					obj.ySpeed = -obj.ySpeed * 0.875;
				break;
			}
		}
	}
}

bool onDrawAmmo(jjPLAYER@ play, jjCANVAS@ canvas) {
    canvas.drawString(
      jjSubscreenWidth - 120,
      jjSubscreenHeight - 30,
      "fastfire x" + (((35 - play.fastfire) + 1) / 3),
      STRING::SMALL,
      STRING::NORMAL
    );
	
    return false;
}