Downloads containing xlmnewbtl09.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 16 Levels Jazz2Online Multiple N/A Download file
JJ2+ Only: Renewed InspirationsFeatured Download Xtreme Level Makers Multiple 9.3 Download file

File preview

// Ancient Acropolis
// Created by PurpleJazz, DarkSonic and Loon of XLM (2014)
// xP

	array <bool> isHealing(4, false);
	uint healthDelay = 0;

	bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) {
     	 	if (isHealing[play.localPlayerID] == true) {
      			canvas.drawString(
			jjSubscreenWidth - 73,
	      			jjSubscreenHeight - 284,
	      			"" + (play.timerTime + 70) / 70,
	      			STRING::LARGE,
	      			STRING::PALSHIFT,
	      			play.timerTime > 3*70?
	      				0 :
	      				jjGameTicks % 28 > 14?
		      				-40 :
		      				-24
			);
		
			canvas.drawSprite(
				jjSubscreenWidth - 90,
				jjSubscreenHeight - 270,
				ANIM::PICKUPS,
				78,
				0
			);
		}
		return true;
	}

	void onLevelLoad() {
		jjWeapons[WEAPON::SEEKER].maximum = 25;

		jjObjectPresets[OBJECT::TOASTERBULLET].behavior = PathOfFire;
		jjObjectPresets[OBJECT::TOASTERBULLET].var[6] = 2 + 16;
		jjObjectPresets[OBJECT::TOASTERBULLET].lightType = LIGHT::BRIGHT;
		jjObjectPresets[OBJECT::TOASTERBULLET].light = 8;
		jjObjectPresets[OBJECT::TOASTERBULLETPU].behavior = PathOfFirePU;
		jjObjectPresets[OBJECT::TOASTERBULLETPU].var[6] = 2 + 16;
		jjObjectPresets[OBJECT::TOASTERBULLETPU].lightType = LIGHT::BRIGHT;
		jjObjectPresets[OBJECT::TOASTERBULLETPU].light = 8;
		jjWeapons[WEAPON::TOASTER].style = WEAPON::MISSILE;
		jjWeapons[WEAPON::TOASTER].multiplier = 1;
		jjWeapons[WEAPON::TOASTER].maximum = 25;

		jjObjectPresets[OBJECT::FIREBALLBULLET].special = jjObjectPresets[OBJECT::FIREBALLBULLET].determineCurAnim(ANIM::MOTH, 0);
		jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = Arrow;
		jjObjectPresets[OBJECT::FIREBALLBULLETPU].special = jjObjectPresets[OBJECT::FIREBALLBULLETPU].determineCurAnim(ANIM::MOTH, 0);
		jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = ArrowPU;
		jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::BRIGHT;
		jjObjectPresets[OBJECT::FIREBALLBULLETPU].light = 8;
		jjObjectPresets[OBJECT::GUN8AMMO3].behavior = ArrowAmmo;
		jjObjectPresets[OBJECT::GUN8AMMO3].determineCurAnim(ANIM::MOTH, 0);

		jjObjectPresets[OBJECT::MILK].determineCurAnim(ANIM::PICKUPS, 78);
		jjObjectPresets[OBJECT::MILK].bulletHandling = HANDLING::IGNOREBULLET;
	}

	void onLevelBegin() {
		if (jjIsServer) jjChat("/fireball on");

		for (int x = 0; x < jjLayerWidth[4]; x++) {
			for (int y = 0; y < jjLayerHeight[4]; y++) {
				uint16 tile = jjTileGet(4, x, y);
						
				if (jjEventGet(x, y) == 119) jjTileSet(4, x, y, tile ^ TILE::VFLIPPED);
			}
		}
	}

	void onPlayer(jjPLAYER@ play) {	
		if (play.food > 1) play.food = 1;

		if (play.health == 0) {
			isHealing[play.localPlayerID] = false;
			play.food = 0;
		}

		if (play.food >= 1) {
			healthRegeneration(play);
			regenerationTimer(play);
			isHealing[play.localPlayerID] = true;
			healthDelay++;
		}

		for (int i = 1; i < jjObjectCount; i++) {
			if (jjObjects[i].eventID == OBJECT::MILK && jjObjects[i].state == STATE::FLOATFALL) {
				jjObjects[i].state = STATE::FLOAT;
			}
		}
	}

	void onPlayerInput(jjPLAYER@ play) {
	if (play.currWeapon == WEAPON::GUN8 && play.keyUp == true) {
		play.keyFire = false;
		}
	}

	void healthRegeneration(jjPLAYER@ play) {
		if (healthDelay > (5*70)) {
    			getHealth(play);
			healthDelay = 0;
		}
	}

	void regenerationTimer(jjPLAYER@ play) {
		if (isHealing[play.localPlayerID] == true && play.timerState == TIMER::STOPPED) play.timerStart(30*70);
		if (isHealing[play.localPlayerID] == true && play.timerTime == 30*70) jjAlert("||||Regeneration!");
		if (isHealing[play.localPlayerID] == false) play.timerStop();
		if (p.timerState == TIMER::STARTED && p.timerTime <= 3*70 && p.timerTime > 0 && p.timerTime % 70 == 0) jjSample(play.xPos, play.yPos, SOUND::COMMON_NOCOIN, 0, 0);
	}

	void getHealth(jjPLAYER@ play) {
		if (play.health < jjMaxHealth) {
			play.health = play.health + 1;
    			jjSample(play.xPos, play.yPos, SOUND::BUBBA_BUBBABOUNCE1, 0, 0);
    			jjSample(play.xPos, play.yPos, SOUND::BUBBA_BUBBABOUNCE2, 0, 0);
			jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
				if (particle !is null) {
					particle.xPos = p.xPos;
					particle.yPos = p.yPos;
					particle.string.text = "||+1";
					particle.ySpeed = -0.25;		
				}
		}
	}

	void onPlayerTimerEnd(jjPLAYER@ play) {
		isHealing[play.localPlayerID] = false;
		play.food = 0;
	}

	void PathOfFire(jjOBJ@ flame) { // thanks Violet
		if (flame.state == STATE::START) {
			jjSample(flame.xPos, flame.yPos, SOUND::AMMO_FIREGUN2A);
			if (jjMaskedPixel(flame.xPos, flame.yPos)) {
				flame.delete();
				return;
			}
			flame.state = STATE::FLY;
			if (flame.direction == 0) flame.direction = (flame.xSpeed < 0) ? -1 : 1;
			float nuY = flame.yPos + (jjRandom() & 7);
			if (!jjMaskedPixel(flame.xPos, nuY))
				flame.yPos = nuY;
			if (flame.creatorType == CREATOR::PLAYER) {// && jjRandom() & 7 == 0) {
				jjPARTICLE@ smoke = jjAddParticle(PARTICLE::SMOKE);
				if (smoke !is null) {
					smoke.xPos = flame.xPos;
					smoke.yPos = flame.yPos;
				}
			} else
				flame.animSpeed = 2;
		}
		if (++flame.counter >= 2) {
			flame.counter = 0;
			if (++flame.frameID == 2) {
				jjOBJ@ nuFlame = jjObjects[jjAddObject(OBJECT::TOASTERBULLET, flame.xPos + 10 * flame.direction, flame.yPos, flame.creatorID, flame.creatorType)];
				nuFlame.direction = flame.direction;
				nuFlame.playerHandling = flame.playerHandling;
			} else if (flame.frameID == 8)
				flame.delete();
		}
		flame.determineCurFrame();
		flame.draw();
	}

	void PathOfFirePU(jjOBJ@ flame) { // thanks again Violet
		if (flame.state == STATE::START) {
			jjSample(flame.xPos, flame.yPos, SOUND::AMMO_FIREGUN2A);
			if (jjMaskedPixel(flame.xPos, flame.yPos)) {
				flame.delete();
				return;
			}
			flame.state = STATE::FLY;
			if (flame.direction == 0) flame.direction = (flame.xSpeed < 0) ? -1 : 1;
			float nuY = flame.yPos + (jjRandom() & 7);
			if (!jjMaskedPixel(flame.xPos, nuY))
				flame.yPos = nuY;
			if (flame.creatorType == CREATOR::PLAYER) {// && jjRandom() & 7 == 0) {
				jjPARTICLE@ smoke = jjAddParticle(PARTICLE::SMOKE);
				if (smoke !is null) {
					smoke.xPos = flame.xPos;
					smoke.yPos = flame.yPos;
				}
			} else
				flame.animSpeed = 2;
		}
		if (++flame.counter >= 2) {
			flame.counter = 0;
			if (++flame.frameID == 2) {
				jjOBJ@ nuFlame = jjObjects[jjAddObject(OBJECT::TOASTERBULLETPU, flame.xPos + 10 * flame.direction, flame.yPos, flame.creatorID, flame.creatorType)];
				nuFlame.direction = flame.direction;
				nuFlame.playerHandling = flame.playerHandling;
			} else if (flame.frameID == 8)
				flame.delete();
		}
		flame.determineCurFrame();
		flame.draw();
	}

	void Arrow(jjOBJ@ arrow) {
		arrow.behave(BEHAVIOR::BULLET);
		if (arrow.state == STATE::FLY) {
			switch(arrow.direction) {
				case 0: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293); break;
				case 1: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293); break;
				case -1: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293 | TILE::HFLIPPED); break;
			}
		}
	}

	void ArrowPU(jjOBJ@ arrow) {
		arrow.behave(BEHAVIOR::BULLET);
		if (arrow.state == STATE::FLY) {
			switch(arrow.direction) {
				case 0: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293); break;
				case 1: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293); break;
				case -1: jjDrawTile(arrow.xPos - 16, arrow.yPos - 16, 293 | TILE::HFLIPPED); break;
			}
		}
		jjPARTICLE@ spark = jjAddParticle(PARTICLE::SPARK);
		if (spark !is null) {
			spark.xPos = arrow.xPos;
			spark.yPos = arrow.yPos;
		}
	}
		

	void ArrowAmmo(jjOBJ@ arrowammo) {
		arrowammo.behave(BEHAVIOR::PICKUP, false);
		arrowammo.yPos = arrowammo.yPos + jjSin(jjGameTicks*10)/4; // floats up and down like a pickup
		if (arrowammo.direction == 1) jjDrawTile(arrowammo.xPos - 16, arrowammo.yPos - 16, 293);
		else jjDrawTile(arrowammo.xPos - 16, arrowammo.yPos - 16, 293 | TILE::HFLIPPED);
	}