Downloads containing ab16ctf12.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 16 Levels Jazz2Online Multiple N/A Download file

File preview

array<int> fastfireCounter(jjLocalPlayerCount, 0);
array<bool> previousKeyFire(jjLocalPlayerCount, false);
void onMain() {
  jjTriggers[0] = jjLocalPlayers[0].teamRed;
  jjLayerXOffset[2] = jjLayerXOffset[2] + 0.5;
	if (jjLayerXOffset[2] > jjLayerWidth[2] * 32)
		jjLayerXOffset[2] = jjLayerXOffset[2] - jjLayerWidth[2] * 32;
}
void onLevelLoad() {
 jjObjectPresets[OBJECT::BOUNCERBULLET].behavior = bouncerBullet;
 jjObjectPresets[OBJECT::BOUNCERBULLETPU].behavior = bouncerBulletPU;
}
void onPlayerInput(jjPLAYER@ player) {
 int ID = player.localPlayerID;
 if (!previousKeyFire[ID]
  && player.keyFire
	&& fastfireCounter[ID] > 0
	&& jjWeapons[player.currWeapon].style != WEAPON::POPCORN)
	player.keyFire = false;
 previousKeyFire[ID] = player.keyFire;
}
void onPlayer(jjPLAYER@ player) {
 int ID = player.localPlayerID;
 fastfireCounter[ID]--;
 if (playerHasShot(player))
  fastfireCounter[ID] = player.fastfire;
}
bool playerHasShot(jjPLAYER@ player) {
  for (int i = 0; i < jjObjectCount; i++){
    jjOBJ@ obj = jjObjects[i];
    if (obj.isActive
		 && obj.eventID < OBJECT::SMOKERING
		 && obj.creatorType == CREATOR::PLAYER
		 && jjPlayers[obj.creatorID] is player
		 && (obj.state == STATE::FLY || obj.state == STATE::ROCKETFLY || obj.state == STATE::BOUNCE)
		 && obj.counter == 1)
		 return true;
  }
  return false;
}
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 = obj.xPos, y = 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;
	 }
	}
 }
}