Downloads containing urbrawl.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Urban BrawlFeatured Download Foly Battle 8.2 Download file

File preview

void onLevelLoad() {
	for (int i = 1; i < 255; i++) {
		jjOBJ@ preset = jjObjectPresets[i];
		if (preset.playerHandling == HANDLING::PICKUP) {
			preset.behavior = CannotBeBuried(preset.behavior);
		}
	}
}

class CannotBeBuried : jjBEHAVIORINTERFACE {
	CannotBeBuried(const jjBEHAVIOR &in behavior) {
		originalBehavior = behavior;
	}
	void onBehave(jjOBJ@ obj) {
		obj.behave(originalBehavior);
		if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + 8))) {
			obj.state = STATE::FLOAT;
			obj.isBlastable = false;
		}
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		if (bullet is null) {
			obj.behavior = originalBehavior;
			if (player.objectHit(obj, force, obj.playerHandling))
				return true;
			obj.behavior = this;
		}
		return false;
	}
	private jjBEHAVIOR originalBehavior;
}

void onMain() {
	for (int i = 1; i < jjObjectCount; i++) {
		if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::COPTER && jjObjects[i].state == STATE::FLY) {
			//Only set the counter if it's available to take
			jjObjects[i].counter = 175;
			if (jjObjects[i].var[4] == 0)
				jjObjects[i].state = STATE::DONE;
		}
		else if (jjObjects[i].isActive && jjObjects[i].eventID == OBJECT::CARROT && jjObjects[i].xPos > 67*32 && jjObjects[i].xPos < 74*32 && jjObjects[i].yPos < 18*32 && jjObjects[i].yPos > (14*32 + 24)) {
			jjObjects[i].particlePixelExplosion(0);
			jjDeleteObject(i);
		}
	}
}