Downloads containing LHDMv2.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 17 Levels Jazz2Online Multiple 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;
	}
}
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;
			}
		}
	}
}