Downloads containing Shaddow1.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Shaddow Game ShaddowBlack0 Single player 6.5 Download file

File preview

int enemyBoss = OBJECT::WITCH;
void onLevelLoad()
{
	jjObjectPresets[enemyBoss].energy = 127;
	jjObjectPresets[enemyBoss].behavior = function(obj) { obj.behavior = FatChickBoss(); };
}
int nextLevelTimer = -1;
int bossObjId = -1;
int TIMER_TICKS = 210;
class FatChickBoss : jjBEHAVIORINTERFACE
{
	int8 backupEnergy = 127;
	void onBehave(jjOBJ@ obj) 
	{
		obj.behave(BEHAVIOR::WITCH, true);
		for(int i=0; i<jjLocalPlayerCount; i++)
		{
			if(abs(obj.xPos - jjLocalPlayers[i].xPos) <= 320 && abs(obj.yPos - jjLocalPlayers[i].yPos) <= 320)
			{
				jjLocalPlayers[i].boss = obj.objectID;
				jjLocalPlayers[i].bossActivated = true;
				if(bossObjId == -1) bossObjId = obj.objectID;
			}
		}
		
		if(obj.energy <= 1)
		{
			//activate boss
			for(int i=0; i<jjLocalPlayerCount; i++)
			{
				jjLocalPlayers[i].bossActivated = false;
			}
			//to destroy boss, instead of obj.delete(); you can use this to spawn a player bullet at the boss position
			//thus you will see the explosion, the object won't just disappear
			if(obj.energy == 1)
			{
				jjAddObject(OBJECT::BLASTERBULLET, obj.xPos, obj.yPos, 0, CREATOR::PLAYER, BEHAVIOR::BULLET);
			}
			//next level:
			if(nextLevelTimer == -1) nextLevelTimer = TIMER_TICKS;
		}
		
		if(backupEnergy != obj.energy)
		{
			if(abs(obj.energy - backupEnergy) > 1)
			{
				obj.energy = backupEnergy - 1;
			}
			else
			{
				backupEnergy = obj.energy;
			}
		}
	}
}

void onMain()
{
	if(nextLevelTimer != -1)
	{
		nextLevelTimer--;
		if(nextLevelTimer == 0)
		{
			cycleLevel();
		}
	}
}

void cycleLevel()
{
	for(int i=0; i<jjLocalPlayerCount; i++)
	{
		int x = int(jjLocalPlayers[i].xPos/32);
		int y = int(jjLocalPlayers[i].yPos/32);
		jjEventSet(x, y, AREA::EOL);
	}
}