int i,b=0; jjPAL Boss; bool final=false; const string MUSICFILENAME = "Jungle.j2b"; void onLevelLoad() { for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID) { jjWEAPON@ weaponProfile = jjWeapons[weaponID]; weaponProfile.comesFromBirds = weaponProfile.comesFromBirdsPowerup = 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(220, 100,150, 0, 0,0, 96, 16, 1.0); Boss.gradient(200, 180, 145, 0, 0, 0, 112, 8, 1.0); Boss.gradient(255, 130, 40, 0, 0, 0, 128, 16, 1.0); Boss.gradient(235, 155, 100, 0, 0, 0, 144, 16, 1.0); Boss.gradient(255, 131, 136, 0, 0, 0, 160, 16, 1.0); Boss.gradient(255, 30, 0, 0, 0, 0, 176, 32, 1.0); Boss.gradient(230, 140, 85, 0, 0, 0, 216, 24, 1.0); jjObjectPresets[OBJECT::BUTTERFLY].scriptedCollisions = true; jjObjectPresets[OBJECT::XMASBILSY].bulletHandling = HANDLING::IGNOREBULLET; } void onLevelReload() { b=0; final=false; jjPalette.reset(); jjLocalPlayers[i].lighting = 100; jjMusicLoad(MUSICFILENAME); } void onMain(){ 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(); } } void onFunction3(jjPLAYER@ play) { //Boss.load("ImprDamn_Ash.j2t"); final=true; jjLocalPlayers[i].lighting = 70; } void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) { 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(play, (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 play.score=play.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) {play.hurt();} else if (bullet.direction == obj.direction) { bullet.ricochet(); obj.energy += 1; } else { //play.showText("It works!", STRING::SMALL); obj.energy -= 1; obj.justHit = 5; bullet.delete(); } } }