Downloads containing StoneAbyss3.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Stone AbyssFeatured Download Bloody_Body Single player 9.6 Download file

File preview

int a=1,n,m=0,s=0,r=0,b=0,i;
jjPAL Boss;
bool final=false;


void onLevelLoad() {
	jjObjectPresets[OBJECT::ROBOT].behavior = RobotRic();
	jjObjectPresets[OBJECT::ROBOT].playerHandling = HANDLING::SPECIAL;
	jjObjectPresets[OBJECT::ROBOT].bulletHandling = HANDLING::DETECTBULLET;
	jjObjectPresets[OBJECT::ROBOT].scriptedCollisions = true;


	
	Boss.gradient(0, 0,0,             0, 0,0,         0, 10, 1.0);
	Boss.gradient(255, 255,255,             255, 255,255,         10, 6, 1.0);
	Boss.gradient(199, 255,0,             199, 255,0,         16, 1, 1.0);
	Boss.gradient(143, 219,0,             0, 11,0,         17, 7, 1.0);
	Boss.gradient(255, 0,0,             163, 0,0,         24, 4, 1.0);
	Boss.gradient(135, 0,0,             11, 0,0,         28, 4, 1.0);
	Boss.gradient(187, 227,255,             0, 139,255,         32, 4, 1.0);
	Boss.gradient(0, 107,203,             0, 7,11,         36, 4, 1.0);
	Boss.gradient(255, 255,0,             255, 199,0,         40, 2, 1.0);
	Boss.gradient(255, 147,0,             255, 95,0,         42, 2, 1.0);
	Boss.gradient(203, 55,0,             11, 0,0,         44, 4, 1.0);
	Boss.gradient(251, 139,183,       239, 0,99,         48, 4, 1.0);            
	Boss.gradient(191, 0,71,      55, 0,19,         52, 4, 1.0);
	Boss.gradient(220, 165,113,             154, 129,100,         56, 3, 1.0);
	Boss.gradient(219, 195,0,             11, 7,0,         59, 5, 1.0);
	Boss.gradient(255, 243,211,             255, 243,211,         64, 1, 1.0);
	Boss.gradient(219, 207,175,             11, 7,7,         65, 7, 1.0);
	Boss.gradient(211, 231,255,             211, 231,255,         72, 1, 1.0);
	Boss.gradient(171, 195,219,             107, 127,155,         73, 3, 1.0);
	Boss.gradient(75, 95,119,             7, 7,11,         76, 4, 1.0);
	Boss.gradient(0, 255,195,             0, 11,7,         80, 8, 1.0);
	Boss.gradient(231, 119,255,             11, 0,7,         88, 8, 1.0);

	Boss.gradient(255, 220, 0,		250, 216, 0,		 	 		96, 2, 1.0);
	Boss.gradient(242, 208, 0,		40, 20, 0,		 	 		98, 14, 1.0);
	Boss.gradient(60, 60, 60,				0, 0, 0,		 	 		112, 8, 1.0);
	Boss.gradient(255, 190, 30,		40, 0, 10,		 	 		128, 16, 1.0);
	Boss.gradient(180, 200, 220,			5, 5, 10,		 	 		144, 16, 1.0);
	Boss.gradient(120, 80, 0,			10, 0, 0,		 	 		160, 16, 1.0);
	Boss.gradient(60, 40, 0,			0, 0, 0,		 	 		176, 32, 1.0);
	//Boss.gradient(30, 20, 0,			0, 0, 0,		 	 		192, 16, 1.0);
	Boss.gradient(100, 135, 170,			0, 0, 0,		 	 		208, 16, 1.0);

	//jjTileSet(4, 178, 12, jjTileGet(4, 178, 12) | TILE::VFLIPPED);	
	//jjTileSet(4, 182, 12, jjTileGet(4, 182, 12) | TILE::VFLIPPED);
	jjTileSet(4, 166, 78, jjTileGet(4, 166, 78) | TILE::VFLIPPED);	
	jjTileSet(4, 170, 78, jjTileGet(4, 170, 78) | TILE::VFLIPPED);


	jjObjectPresets[OBJECT::BUTTERFLY].behavior = FlippedSucker;
	jjObjectPresets[OBJECT::BUTTERFLY].points = 200;
	jjObjectPresets[OBJECT::BUTTERFLY].playerHandling = HANDLING::ENEMY;
	jjObjectPresets[OBJECT::BUTTERFLY].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::BUTTERFLY].isTarget = true;
	jjObjectPresets[OBJECT::BUTTERFLY].energy = 1;
	jjObjectPresets[OBJECT::BUTTERFLY].determineCurAnim(ANIM::SUCKER,0);
	jjObjectPresets[OBJECT::BUTTERFLY].scriptedCollisions = true;
	
	jjObjectPresets[OBJECT::PACMANGHOST].behavior = BlueGhost;
	jjObjectPresets[OBJECT::PACMANGHOST].points = 300;
    jjObjectPresets[OBJECT::PACMANGHOST].playerHandling = HANDLING::SPECIAL;
	jjObjectPresets[OBJECT::PACMANGHOST].bulletHandling = HANDLING::HURTBYBULLET;
	jjObjectPresets[OBJECT::PACMANGHOST].isTarget = true;
	jjObjectPresets[OBJECT::PACMANGHOST].isBlastable = true;
	jjObjectPresets[OBJECT::PACMANGHOST].state = STATE::START;
	jjObjectPresets[OBJECT::PACMANGHOST].scriptedCollisions = true;
	jjObjectPresets[OBJECT::PACMANGHOST].energy = 8;
	
			for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID) {
		jjWEAPON@ weaponProfile = jjWeapons[weaponID];
		weaponProfile.comesFromBirds = weaponProfile.comesFromBirdsPowerup = true; 
	}
jjObjectPresets[OBJECT::ROBOT].scriptedCollisions = true;
jjObjectPresets[OBJECT::ROBOT].points = 2000;


jjObjectPresets[OBJECT::PINKPLATFORM].behavior = MovingPlatform;
jjObjectPresets[OBJECT::PINKPLATFORM].state = STATE::WAIT;
jjObjectPresets[OBJECT::PINKPLATFORM].determineCurAnim(ANIM::PINKPLAT,0);
jjObjectPresets[OBJECT::PINKPLATFORM].isFreezable = false;
jjObjectPresets[OBJECT::PINKPLATFORM].deactivates = false;
}

void onMain(){
//for (int y = 1; y < jjObjectCount; y++) { //jjObjects[0] is never active, so we start the index at 1
//	jjOBJ@ o = jjObjects[y];
//	if (o.isActive && o.eventID == OBJECT::BUTTERFLY && y % 2 == 0) {
//		o.frameID = jjGameTicks >> 3.5;}
//		else
//		{o.frameID = jjGameTicks >> 3;
//	}
//}

if (b<=99 && final && (jjGameTicks % 5) == 0) { 
b++;
		jjPalette.reset();
		jjPalette.copyFrom(
			1,		
			254,		
			1,		
			Boss,	
			b/100.0	
		);
		jjPalette.apply();
		}
		else if (b==99) {
		Boss.apply();
		}
updateGems();		
		}
 
void onLevelReload() {
final=false;
r=0;
b=0;
jjPalette.reset();
}

void updateGems()
{
  for(int i=1;i<jjObjectCount;i++)
  {
    if(jjObjects[i].isActive)
    {
      if(jjObjects[i].eventID==OBJECT::SUPERGEM)
      {
        jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32,0,2)+1;
      }
      if(jjObjects[i].eventID==OBJECT::FLICKERGEM)
      {
        if(jjEventGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32)==OBJECT::SUPERGEM)
        {
          jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32,0,2)+1;
        }
        else if(jjEventGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32+1)==OBJECT::GEMSTOMP)
        {
          jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32+1,0,2)+1;
        }
        if(jjObjects[i].var[0]==2||jjObjects[i].var[0]==3)
        {
          jjObjects[i].points=500*(jjObjects[i].var[0]-1);
        }
      }
    }
  }
}
		
void FlippedSucker (jjOBJ@ enemy){
		
	if  (enemy.state == STATE::START)
		enemy.yPos+=16;
	if (jjGameTicks%100==0)
		jjSample(enemy.xPos, enemy.yPos, SOUND::SUCKER_PLOPSEQ1);
	if (jjGameTicks%100==30)
		jjSample(enemy.xPos, enemy.yPos, SOUND::SUCKER_PLOPSEQ4);
	if (enemy.state==STATE::FREEZE) {
		if (enemy.freeze > 0)
			enemy.freeze -= 2;
		if (enemy.freeze < 2)
			enemy.state = enemy.oldState;
	} else {
		enemy.behave(BEHAVIOR::BUTTERFLY, false);
		enemy.frameID = jjGameTicks >> 3;
		enemy.determineCurFrame();
	}
	enemy.draw();
}

		void BlueGhost (jjOBJ@ enemy)  {
		enemy.determineCurAnim(ANIM::ZSPARK,0);
		if (enemy.justHit == 0)
		{jjDrawSpriteFromCurFrame(enemy.xPos, enemy.yPos, enemy.curFrame, enemy.direction, SPRITE::NORMAL);}
		else { jjDrawSpriteFromCurFrame(enemy.xPos, enemy.yPos, enemy.curFrame, enemy.direction, SPRITE::SINGLECOLOR,15);}
		//jjAlert("enemy.xSpeed "+ formatInt(enemy.xSpeed, "1"));
		//jjAlert("enemy.ySpeed "+ formatInt(enemy.ySpeed, "1"));
		jjPLAYER@ play = jjLocalPlayers[0];
				 	if (enemy.xPos > play.xPos+3 || enemy.xPos < play.xPos-3)
	{enemy.direction = (enemy.xPos < play.xPos) ? -1 : 1;}
	else 
				{
				enemy.direction==1;}	
		
		//if (enemy.justHit == 0)
		
		enemy.frameID = (jjGameTicks/10) & 31;
		enemy.determineCurFrame();	
		switch (enemy.state){
	case STATE::START: {
	if	(enemy.findNearestPlayer(100*800) > -1)	
		{enemy.state = STATE::FLOAT;}
		enemy.xSpeed = 1;
		enemy.ySpeed = 1;
		break;
			
	}
	case STATE::FREEZE:
			if (enemy.freeze > 0) {
				enemy.draw();
				enemy.freeze -= 2;
			}
			if (enemy.freeze < 2) {
				
				enemy.state = enemy.oldState;
			}
			break; 
	case  STATE::DEACTIVATE: {
		enemy.deactivate();
		break;
	} case STATE::KILL: {
	enemy.delete();
		  int explosionID = jjAddObject(OBJECT::BOMB, enemy.xPos, enemy.yPos, enemy.creator, CREATOR::OBJECT);
		jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 5, true);
		jjObjects[explosionID].state = STATE::EXPLODE;
		
		
		break;
	} case STATE::FLOAT: {
	if (enemy.justHit != 0 )
	{enemy.ySpeed = 1.15*enemy.ySpeed;
	enemy.xSpeed = 1.15*enemy.xSpeed;
	}

		
			{	if (enemy.xPos > play.xPos)
				{
				enemy.xPos = enemy.xPos - (jjSin(jjGameTicks*30)/2+(abs((jjDifficulty-0.4)*enemy.xSpeed))-0.4); }
		else if (enemy.xPos < play.xPos) 
				{
				enemy.xPos = enemy.xPos + (jjSin(jjGameTicks*30)/2+(abs((jjDifficulty-0.4)*enemy.xSpeed))-0.4);}
				
		if (enemy.yPos > play.yPos)
				{enemy.yPos = enemy.yPos - (jjSin(jjGameTicks*30)/2+(abs((jjDifficulty-0.4)*enemy.ySpeed))-0.4); }
		else if (enemy.yPos < play.yPos) 
				{enemy.yPos = enemy.yPos + (jjSin(jjGameTicks*30)/2+(abs((jjDifficulty-0.4)*enemy.ySpeed))-0.4);}
				}
if (jjLocalPlayers[0].xPos > enemy.xPos && jjMaskedPixel(enemy.xPos, enemy.yPos + enemy.ySpeed) ){enemy.xSpeed =abs(enemy.xSpeed); }
else if (jjLocalPlayers[0].xPos < enemy.xPos && jjMaskedPixel(enemy.xPos, enemy.yPos + enemy.ySpeed) )
{enemy.xSpeed = -abs(enemy.xSpeed);}
		if (jjRandom() & 15 == 0&&enemy.findNearestPlayer(10*10) > -1)	{
				
			
				jjOBJ@ bullet = jjObjects[enemy.fireBullet(OBJECT::BOMB)];
				bullet.playerHandling = HANDLING::ENEMYBULLET;	
				bullet.animSpeed = 1;				
				bullet.xPos=enemy.xPos;
				bullet.yPos=enemy.yPos;
				if (bullet.age==0) {bullet.state = STATE::KILL;}
			}
	}

	break;
	}
	

		//enemy.draw();
	}
	
void MovingPlatform(jjOBJ@ plat) {

	jjDrawTile(plat.xPos - 31, plat.yPos - 14, 854);
	jjDrawTile(plat.xPos + 1,  plat.yPos - 14, 855);
switch (plat.state){
case STATE::WAIT:
plat.state = STATE::FADEIN;
break;
case STATE::DEACTIVATE:
		plat.xOrg = plat.xAcc;
		plat.yOrg = plat.yAcc;
break;		
case STATE::FADEIN:

if (plat.yOrg<44*32&&plat.xOrg>64*32&&plat.xOrg<66*32&&jjTriggers[0])
	plat.yOrg = (28*32) + jjSin(++plat.counter*(1+0.2*jjDifficulty))*(15*32);
else if (plat.xOrg>22*32&&plat.xOrg<24*32&&plat.yOrg>54*32&&jjTriggers[1])	
	plat.yOrg = (65*32) + jjCos(++plat.counter*(1+0.2*jjDifficulty))*(10*32);
else if (plat.xOrg<69*32&&plat.xOrg>53*32&&plat.yOrg>65*32&&jjTriggers[2])		
	{plat.xOrg = (61*32) - jjCos(++plat.counter*(1+0.2*jjDifficulty))*(7*32);
	plat.yOrg = (70*32) - jjCos(++plat.counter*(1+0.2*jjDifficulty))*(4*32);}
else if (plat.xOrg>69*32&&plat.xOrg<71*32&&plat.yOrg>39*32&&jjTriggers[2])	
	plat.yOrg = (60*32) + jjCos(++plat.counter*(1+0.2*jjDifficulty))*(14*32);
else if (plat.xOrg>147*32&&plat.xOrg<149*32&&plat.yOrg<63*32&&jjTriggers[4])	
	plat.yOrg = (55*32) + jjCos(++plat.counter*(1+0.2*jjDifficulty))*(5*32);
else if (plat.xOrg>174*32&&plat.xOrg<176*32&&plat.yOrg>47*32)	
	plat.yOrg = (67*32) + jjCos(++plat.counter*(1+0.2*jjDifficulty))*(17*32);
else if (plat.xOrg>180*32&&plat.xOrg<182*32&&plat.yOrg<36*32&&jjTriggers[5])	
	plat.yOrg = (23*32) + jjCos(++plat.counter*(1+0.2*jjDifficulty))*(11*32);
else if (plat.yOrg>48*32&&plat.yOrg<55*32&&plat.xOrg>259*32&&plat.xOrg<280*32&&jjTriggers[9])	
	{plat.yOrg = (49*32) + abs(jjSin(++plat.counter)*(4*32));
	plat.xOrg = (269*32) - jjCos(++plat.counter)*(9*32);}
	
if (plat.xSpeed!=0||plat.ySpeed<0){
if (jjGameTicks%10==0)
{jjSample(plat.xOrg, plat.yOrg, SOUND::BUBBA_BUBBAEXPLO);}
		}
		break;
}
	plat.behave(BEHAVIOR::PLATFORM, false); 
	
}

//	void onFunction0(jjPLAYER@ play) {
// jjTriggers[1]=true;
//}


	void onFunction1(jjPLAYER@ play) {
 jjTriggers[2]=true;
}

	void onFunction2(jjPLAYER@ play) {
 jjTriggers[4]=true;
}
	void onFunction3(jjPLAYER@ play) {
play.showText("Tube is destroyed");	
 jjTriggers[7]=true;
}

	void onFunction4(jjPLAYER@ play) {
 	play.revertMorph(false);
 jjTriggers[8]=true;
}

	void onFunction5(jjPLAYER@ play) {
 	play.revertMorph(false);
 jjTriggers[9]=true;
}

			void onFunction6(jjPLAYER@ play) {
	final=true;		
	jjLocalPlayers[i].lighting = 70;
	}

void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ p, int force) {
	
		
		/*if (obj.eventID == OBJECT::ROBOT)
		
		{
		if (force == 0) 
				{p.hurt();}
		else if (bullet.var[3] != WEAPON::TOASTER&&jjRandom() & 100 != 0)
		{obj.bulletHandling = HANDLING::HURTBYBULLET;
		n==2;
		jjAlert("n "+ formatInt(n, "1"));
		bullet.ricochet();
		obj.energy += 1;
		
		
			//obj.playerHandling = HANDLING::SPECIAL;
			//
		}		
		else if (bullet.var[3] == WEAPON::TOASTER&&r==0) {
						//obj.playerHandling = HANDLING::PARTICLE;
				p.showText("@@My bot is heat resistant! @Flamethrower is useless against it!");
				r=1;
				obj.bulletHandling = HANDLING::DESTROYBULLET;	
				n==1;
		jjAlert("n "+ formatInt(n, "1"));
			}
			else {obj.bulletHandling = HANDLING::HURTBYBULLET;
				obj.energy -= 1;
				obj.justHit = 5;
				bullet.delete();
			}}*/
			if (obj.eventID == OBJECT::BUTTERFLY){
	
			if (obj.energy <= 0) {
					if (bullet !is null) {
						if ((bullet.var[6] & 2) == 2) { //toaster and its ilk
							obj.particlePixelExplosion(1); //burny explosion
							jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BURN);
						} else {
							obj.particlePixelExplosion(0);
						}
						obj.grantPickup(p, (bullet.eventID == OBJECT::BLASTERBULLET) ? 5 : 10);
							//JJ2 only ever calls grantPickup for enemies/crates destroyed
							//by bullets, but you can branch out a bit if you like
					} else {
						obj.particlePixelExplosion(1); //killed by physical contact
						jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SPLAT1);
					}
					obj.state = STATE::KILL; //let the object's behavior function take care of deleting it
					p.score=p.score+100;
					jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
			if (particle !is null) {
				particle.xPos = obj.xPos;
				particle.yPos = obj.yPos;
				particle.string.text = "100";
				particle.ySpeed = -1.2;
				particle.xSpeed = -1.1;
			}	
					
				}
		
		if (force == 0) 
				{p.hurt();}
		else if (bullet.direction == obj.direction) {
				bullet.ricochet();
				
				obj.energy += 1;
			}
			else {
				obj.energy -= 1;
				obj.justHit = 5;
				bullet.delete();
			}
				
			}
			 if (obj.eventID == OBJECT::PACMANGHOST)
		{
		if (force > 0) 
		{			obj.energy -=1;
		obj.justHit = 5;
				bullet.delete();}
		
				
				if (obj.energy <= 0) {
					if (bullet !is null) {
						if ((bullet.var[6] & 2) == 2) { //toaster and its ilk
							obj.particlePixelExplosion(1); //burny explosion
							jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BURN);
						} else {
							obj.particlePixelExplosion(0);
						}
						obj.state = STATE::KILL;
						p.score += obj.points;
						}
						jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING);
			if (particle !is null && force > 0) {
				particle.xPos = obj.xPos;
				particle.yPos = obj.yPos;
				particle.string.text = "300";
				particle.ySpeed = -1;
				particle.xSpeed = -1.1;
					} 
					 //let the object's behavior function take care of deleting it
						
					
				 }
	
}}
/*
class RobotRic : jjBEHAVIORINTERFACE {
 void onBehave(jjOBJ@ obj) {
  obj.behave(BEHAVIOR::ROBOT, true);
  jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
 }
 bool onObjectHit(jjOBJ@ obj, jjOBJ@ bull, jjPLAYER@ play, int force) {
if (bull is null)
   {play.objectHit(obj, 0, HANDLING::ENEMY);}
  else if (bull.var[3] == WEAPON::TOASTER) {
  if (r==0)
  {r=1;
  play.showText("@@My bot is heat resistant! @Flamethrower is useless against it!");}
   obj.playerHandling = HANDLING::ENEMY;
   obj.bulletHandling = HANDLING::DESTROYBULLET;
   bull.objectHit(obj, HANDLING::ENEMY);
   obj.playerHandling = jjObjectPresets[obj.eventID].playerHandling;
   obj.bulletHandling = jjObjectPresets[obj.eventID].bulletHandling;
   
  }
  else if (bull.var[3] == WEAPON::BLASTER) {
   if (jjRandom() & 100 != 0) {
				bull.ricochet();
				obj.energy += 1;
			}
			else {
				obj.energy -= 1;
				obj.justHit = 5;
				bull.delete();
			}
   
  }  else {
  bull.ricochet();
		obj.energy -= 0;
   obj.bulletHandling = HANDLING::HURTBYBULLET;
  }
  return true;
 }
}
*/
class RobotRic : jjBEHAVIORINTERFACE {
 void onBehave(jjOBJ@ obj) {
  obj.behave(BEHAVIOR::ROBOT, true);
  //jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
 }
 bool onObjectHit(jjOBJ@ obj, jjOBJ@ bull, jjPLAYER@ play, int force) {
	 if (bull !is null) {
		if (bull.var[3] == WEAPON::TOASTER) {
		  if (r==0)
		  {r=1;
		  play.showText("@@My bot is heat resistant! @Flamethrower is useless against it!");}
		   bull.state = STATE::EXPLODE;
		   return true;
		} else {
			if ((jjRandom() % 10) != 0) {
				bull.ricochet();
				return true;
			}
		}
	 }
	 obj.scriptedCollisions = false;
	 if (bull is null)
		play.objectHit(obj, force, HANDLING::SPECIAL);
	else {
	 obj.bulletHandling = HANDLING::HURTBYBULLET;
		bull.objectHit(obj, HANDLING::SPECIAL);
	}
	 if (obj.state != STATE::KILL && obj.state != STATE::DONE) {
		obj.scriptedCollisions = true;
	 obj.bulletHandling = HANDLING::DETECTBULLET;
	}
	 return true;
 }
}