Downloads containing StoneAbyss11.j2as

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

File preview

int i,t=0,b=0;
jjPAL Boss;
bool final=false;
const int cSpreadSpeed = 0; //The higher this value the more the shards will spread perpendicular to the blasterbullet
const float cSlowDownSpeed = 6; //How much the shards slow down compared to the bullet
const int cTrailLifeTime= 70*1.5; //How long the shards will exist
//const int cGreenDensityFactor = 1; //A lower factor gives more green shards
const int cBlueDensityFactor = 1; //A lower factor gives more blue shards

	void onMain(){
	jjPLAYER@ play = jjLocalPlayers[0];
	
	if (b<=99 && final && (jjGameTicks & 20) == 0) { 
b++;
		jjPalette.reset();
		jjPalette.copyFrom(
			1,		
			254,		
			1,		
			Boss,	
			b/100.0	
		);
		jjPalette.apply();
		}
		else if (b==99) {
		Boss.apply();
		}
	
	if (play.frozen!=0 && t==0)
	{t=1;
	play.showText("@The trees spitting freezers?@Well, having met the Cheshires @crapping by flames, @I can't be surprised by anything.", STRING::SMALL);}
	  for (int i = 0;  i < jjObjectCount; i++)
    if (jjObjects[i].isActive && jjObjects[i].creatorType == CREATOR::LEVEL) {
      //Shard Trail
      if ((jjGameTicks%cBlueDensityFactor == 0 && (jjObjects[i].eventID == OBJECT::FREEZER)) && jjObjects[i].state != STATE::EXPLODE) {
        CreateShardTrail(i, (jjObjects[i].eventID == OBJECT::FREEZER));
        continue;
      }
 
      //Maintain shard lifetime
      if (jjObjects[i].eventID == OBJECT::SHARD && jjObjects[i].special == 12) {
        jjObjects[i].age++;
        if (jjObjects[i].age > cTrailLifeTime)
          jjDeleteObject(i);
        continue;
      }
    }
	
	updateGems();
	}

void onLevelLoad() {

		for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID) {
		jjWEAPON@ weaponProfile = jjWeapons[weaponID];
		weaponProfile.comesFromBirds = weaponProfile.comesFromBirdsPowerup = true; 
	}
// неплохо бы прописать заморозку игрока, её длительность, и добавить звук бьющегося стекла. и не забудь про лазерный щит. ну и ветра морозные добавь.
	jjPalette.gradient(255, 50, 100,			0, 0, 0, 		 	96, 16, 1.0);
	jjPalette.gradient(100, 100, 255,	0, 0, 60, 				 		112, 16, 1.0);
	jjPalette.gradient(160, 160, 255,			0, 0, 50,		 		128, 16, 1.0);
	jjPalette.gradient(80, 80, 155,			0, 0, 0,		 		144, 16, 1.0);
	jjPalette.gradient(80, 5, 15,			0, 0, 0,		 		160, 16, 1.0);
	jjPalette.gradient(120, 15, 30,			0, 0, 0,		 		176, 16, 1.0);
	jjPalette.gradient(100, 0, 100,			0, 0, 0,		 		208, 16, 1.0);
	//jjPalette.gradient(255, 20, 20,			100, 2, 2,		 		208, 16, 1.0);
	
	
	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, 200, 85,			1, 1, 1, 		 	96, 16, 1.0);
	Boss.gradient(105, 90, 69,			7, 1, 1, 		 		112, 16, 1.0);
	Boss.gradient(255, 69, 55,			27, 11, 8,		 		128, 16, 1.0);
	Boss.gradient(50, 25, 15,			10, 7, 5,		 		160, 16, 1.0);
	Boss.gradient(90, 50, 30,			12, 9, 6,		 		176, 16, 1.0);
	Boss.gradient(255, 20, 20,			100, 2, 2,		 		208, 16, 1.0);
	
	
	
	
	/*jjPalette.gradient(255,200,200,		     100, 70, 70, 			  96, 16, 1.0);//wood
	//jjPalette.gradient(125,50,60,		     0, 0, 0, 			      99, 13, 1.0);//wood
	jjPalette.gradient(60,60,140,		     0, 0, 0, 			      112, 16, 1.0);//sand
	jjPalette.gradient(200,220,255,		     0, 0, 0, 			      128, 16, 1.0);//grass
	jjPalette.gradient(255,220,60,			 215, 125, 50, 			  144, 4, 1.0);//shells
	jjPalette.gradient(205,100,45,			 60, 30, 0, 			  148, 12, 1.0);//shells
	jjPalette.gradient(175,10,80,		     110, 45, 50, 			  160, 3, 1.0);//ships
	jjPalette.gradient(95,30,40,		         0, 0, 0, 			      163, 13, 1.0);//ships
	jjPalette.gradient(0,0,0,		         0, 0, 0, 			      176, 16, 1.0);
	jjPalette.gradient(140,50,25,			 0, 0, 0, 			 	  192, 32, 1.0);*/
	
	/*jjPalette.gradient(255, 200, 85,			1, 1, 1, 		 	96, 16, 1.0);
	jjPalette.gradient(105, 90, 69,			7, 1, 1, 		 		112, 16, 1.0);
	jjPalette.gradient(255, 69, 55,			27, 11, 8,		 		128, 16, 1.0);
	jjPalette.gradient(50, 25, 15,			10, 7, 5,		 		160, 16, 1.0);
	jjPalette.gradient(90, 50, 30,			12, 9, 6,		 		176, 16, 1.0);
	jjPalette.gradient(255, 20, 20,			100, 2, 2,		 		208, 16, 1.0);*/
	
	jjObjectPresets[OBJECT::FREEZER].points = 0;
	//jjObjectPresets[OBJECT::FREEZER].scriptedCollisions = true;		
	jjObjectPresets[OBJECT::FREEZER].behavior = Freezer1;	
	jjObjectPresets[OBJECT::FREEZER].state = STATE::ACTION;
	jjObjectPresets[OBJECT::FREEZER].deactivates = false;
	jjObjectPresets[OBJECT::FREEZER].lightType = LIGHT::NORMAL;
	jjObjectPresets[OBJECT::FREEZER].light = 8;
	
	jjObjectPresets[OBJECT::APPLE].bulletHandling = HANDLING::IGNOREBULLET;
	jjObjectPresets[OBJECT::APPLE].playerHandling = HANDLING::PARTICLE;
	jjObjectPresets[OBJECT::APPLE].lightType = LIGHT::BRIGHT;
	jjObjectPresets[OBJECT::APPLE].light = 10;
	jjObjectPresets[OBJECT::APPLE].behavior = Fire;	
	
	jjObjectPresets[OBJECT::BEES].behavior = Spitter;
	jjObjectPresets[OBJECT::BEES].bulletHandling = HANDLING::IGNOREBULLET;
	jjObjectPresets[OBJECT::BEES].playerHandling = HANDLING::EXPLOSION;
	jjObjectPresets[OBJECT::BEES].deactivates = false;
	}
	
	const string MUSICFILENAME = "hell.j2b";	
			void onLevelReload()  {
		b=0;
	final=false;
	jjPalette.reset();
	jjLocalPlayers[i].lighting = 60;
	jjMusicLoad(MUSICFILENAME);
	}	
	
	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 CreateShardTrail(int bulletID, bool greentrail) {
  int shardID = jjAddObject(OBJECT::SHARD, jjObjects[bulletID].xPos, jjObjects[bulletID].yPos, 0, CREATOR::LEVEL);
  jjObjects[shardID].special = 12;
  if (greentrail)
    jjObjectPresets[OBJECT::SHARD].determineCurAnim(ANIM::PICKUPS, 6+jjRandom()%4, true);
  else
    jjObjectPresets[OBJECT::SHARD].determineCurAnim(ANIM::PICKUPS, 44+jjRandom()%4, true);
  if (jjObjects[bulletID].direction != 0) {
    jjObjects[shardID].xSpeed = jjObjects[bulletID].xSpeed - jjObjects[bulletID].direction*cSlowDownSpeed;
    jjObjects[shardID].ySpeed = -cSpreadSpeed*(jjRandom()%32 - 16)/16;
  } else {
    jjObjects[shardID].xSpeed = -cSpreadSpeed*(jjRandom()%32 - 16)/16;
    jjObjects[shardID].ySpeed = jjObjects[bulletID].ySpeed + cSlowDownSpeed;
  }
}
	
	void Spitter(jjOBJ@ obj) {
	++obj.counter;
	jjOBJ@ bullet = jjObjectPresets[OBJECT::FREEZER];	


	
	if (jjParameterGet(obj.xPos/32, obj.yPos/32, 0, 4)==0 &&((obj.counter % 100) == 50))
	//bullet.behavior = Freezer1;
	{obj.fireBullet(OBJECT::FREEZER);
	
		switch(jjRandom()%4) {
	  	case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU1); break;
	  	case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU2); break;
	  	case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU3); break;
		case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU4); break;
	}
	bullet.xPos = bullet.xPos-16;
	bullet.yPos = bullet.yPos-22;
	bullet.determineCurAnim(ANIM::AMMO,30);
	bullet.direction=-1;}
	else if (jjParameterGet(obj.xPos/32, obj.yPos/32, 0, 4)==1 &&((obj.counter % 100) == 0))
	//bullet.behavior = Freezer2;
	{obj.fireBullet(OBJECT::FREEZER);
	
		switch(jjRandom()%4) {
	  	case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU1); break;
	  	case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU2); break;
	  	case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU3); break;
		case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU4); break;
	}
	bullet.xOrg = bullet.xOrg-16;
	bullet.yOrg = bullet.yOrg-22;
	bullet.determineCurAnim(ANIM::AMMO,30);
	bullet.direction=1;}
	
		else if (jjParameterGet(obj.xPos/32, obj.yPos/32, 0, 4)==2 &&((obj.counter % 100) == 20))
	//bullet.behavior = Freezer2;
	{obj.fireBullet(OBJECT::FREEZER);
	
		switch(jjRandom()%4) {
	  	case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU1); break;
	  	case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU2); break;
	  	case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU3); break;
		case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU4); break;
	}
	bullet.xPos = bullet.xPos-16;
	bullet.yPos = bullet.yPos-22;
	bullet.determineCurAnim(ANIM::AMMO,30);
	//jjDrawSpriteFromCurFrame(bullet.xPos, bullet.yPos, bullet.curFrame, bullet.direction, SPRITE::FROZEN);
	}
			else if (jjParameterGet(obj.xPos/32, obj.yPos/32, 0, 4)==3 &&((obj.counter % 50) == 20))
	//bullet.behavior = Freezer2;
	{obj.fireBullet(OBJECT::FREEZER);
	
		switch(jjRandom()%4) {
	  	case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU1); break;
	  	case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU2); break;
	  	case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU3); break;
		case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_ICEPU4); break;
	}
	bullet.xPos = bullet.xPos-16;
	bullet.yPos = bullet.yPos-22;
	bullet.determineCurAnim(ANIM::AMMO,30);
	//jjDrawSpriteFromCurFrame(bullet.xPos, bullet.yPos, bullet.curFrame, bullet.direction, SPRITE::FROZEN);
	}
	
	//jjAlert("obj.counter "+ formatInt(obj.counter, "1"));
	
	if (obj.state == STATE::START) {

		//obj.behave(BEHAVIOR::FreezerX);
		obj.state = STATE::ACTION;
	}
}
						
							void Freezer1(jjOBJ@ enemy) {
							enemy.behave(BEHAVIOR::PICKUP, false);
							if (enemy.yOrg>18*32 && enemy.yOrg<20*32 || enemy.yOrg>33*32 && enemy.yOrg<35*32 || enemy.yOrg>50*32 && enemy.yOrg<52*32 || enemy.yOrg>53*32 && enemy.yOrg<55*32 || enemy.yOrg>55*32 && enemy.yOrg<57*32 || enemy.yOrg>68*32 && enemy.yOrg<70*32|| enemy.yOrg>75*32 && enemy.yOrg<77*32 || enemy.yOrg>74*32 && enemy.yOrg<76*32 || enemy.yOrg>73*32 && enemy.yOrg<75*32 || enemy.yOrg>78*32 && enemy.yOrg<80*32) //I know, it's the stupidest way of determinating bullet's direction. But it works.
							{enemy.direction=-1; //to the left
							enemy.xOrg= enemy.xOrg+122;
							enemy.xPos = enemy.xPos - (4+jjDifficulty*2); 
							enemy.yPos = enemy.yOrg + 12; 
							}
							else	if (enemy.yOrg>14*32 && enemy.yOrg<16*32 || enemy.yOrg>21*32 && enemy.yOrg<23*32 || enemy.yOrg>36*32 && enemy.yOrg<38*32 || enemy.yOrg>45*32 && enemy.yOrg<47*32 || enemy.yOrg>58*32 && enemy.yOrg<60*32  || enemy.yOrg>66*32 && enemy.yOrg<68*32 || enemy.yOrg>68*32 && enemy.yOrg<70*32 || enemy.yOrg>71*32 && enemy.yOrg<73*32 || enemy.yOrg>79*32 && enemy.yOrg<81*32 || enemy.yOrg>84*32 && enemy.yOrg<86*32)
							{enemy.direction=1; //to the right
							enemy.xOrg= enemy.xOrg+22;
							enemy.xPos = enemy.xPos + (4+jjDifficulty*2); 
							enemy.yPos = enemy.yOrg + 12; 
							}
	
		
		//enemy.determineCurAnim(ANIM::AMMO, 30);
		enemy.determineCurFrame();
		enemy.frameID = enemy.counter/8;
		jjDrawSpriteFromCurFrame(enemy.xPos, enemy.yPos, enemy.curFrame, enemy.direction, SPRITE::FROZEN);
		++enemy.counter;
		enemy.counter += 1; 
		if (jjMaskedPixel(enemy.xPos + enemy.xSpeed, enemy.yPos)) 
		{enemy.delete();
		  int explosionID = jjAddObject(OBJECT::ICEBULLET, enemy.xPos, enemy.yPos, enemy.creator, CREATOR::OBJECT);
		jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 8, false);
		jjObjects[explosionID].state = STATE::EXPLODE;
		}
	//enemy.draw();
	}
	
								void Freezer2(jjOBJ@ enemy) {
		jjPLAYER@ play = jjLocalPlayers[0];
		
		
				enemy.xPos = enemy.xPos + (2+jjDifficulty); 
	
		enemy.direction=1;
		enemy.determineCurAnim(ANIM::AMMO, 30);
		enemy.determineCurFrame();
		enemy.frameID = enemy.counter/8;
		jjDrawSpriteFromCurFrame(enemy.xPos, enemy.yPos, enemy.curFrame, enemy.direction, SPRITE::NORMAL);
		//enemy.draw();
		++enemy.counter;
		enemy.counter += 1; 
		 if (enemy.counter >200*jjDifficulty/2+400)
		{enemy.delete();
		  int explosionID = jjAddObject(OBJECT::ICEBULLET, enemy.xPos, enemy.yPos, enemy.creator, CREATOR::OBJECT);
		jjObjects[explosionID].determineCurAnim(ANIM::AMMO, 8, false);
		jjObjects[explosionID].state = STATE::EXPLODE;
		}
	//enemy.draw();
	}
	
	void Fire(jjOBJ@ obj) {
	jjPLAYER@ play = jjLocalPlayers[0];
	if (play.xPos < obj.xPos +16 && play.xPos > obj.xPos -16 && play.yPos > obj.yPos -26 && play.yPos < obj.yPos + 16 )
{play.hurt();}

	if (jjGameTicks%100==0)
		{jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BURNIN);}
	obj.behave(BEHAVIOR::PICKUP, false);
	}
	
				void onFunction1(jjPLAYER@ play) {
			//Boss.load("ImprDamn_Ash.j2t");
	final=true;		
	jjLocalPlayers[i].lighting = 100;
	}
	
		void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
	if (obj.eventID == OBJECT::FREEZER) { 

		play.showText("@Wait or press fire @ to unfreeze yourself!", STRING::SMALL);
		//jjSample(obj.xPos, obj.yPos, SOUND::BUBBA_BUBBABOUNCE2);
	}
}