jjPAL Boss; bool final=false; int i,a=0,b=0,KilledTUFTurts=0; jjOBJ@ spawnedObject; void onLevelLoad() { //jjTexturedBGTexture = TEXTURE::WISETYNESS; jjObjectPresets[OBJECT::TUFBOSS].behavior = TUFBOSS1; jjPIXELMAP rain(32,32); for (uint x = 0; x < rain.width; ++x) { for (uint y = 0; y < rain.height; ++y) { if (x == 16) { //draw in the middle of the tile, xPixel 16 if (y <= 24) rain[x,y] = 75; //if at yPixel 24 or less, use color 75 else rain[x,y] = 74; //use color 74 for yPixels 25-32 } else { rain[x,y] = 0; } } } jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2]; for (uint frameID = 0; frameID < anim.frameCount; ++frameID) { jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame + frameID]; rain.save(frame); frame.hotSpotX = -frame.width/2; frame.hotSpotY = -frame.height; } //jjPalette.gradient(255, 200, 0, 0, 0, 0, 96, 8, 1.0); //jjPalette.gradient(160, 100, 70, 0, 0, 0, 104, 8, 1.0); //jjPalette.gradient(70, 160, 100, 0, 0, 0, 104, 8, 1.0); //jjPalette.gradient(255, 100, 0, 190, 20, 0, 112, 8, 1.0); //jjPalette.gradient(175, 10, 0, 0, 0, 0, 120, 8, 1.0); //jjPalette.gradient(225, 175, 200, 20, 0, 10, 128, 16, 1.0); //jjPalette.gradient(160, 80, 0, 20, 10, 0, 144, 16, 1.0); //jjPalette.gradient(210, 135, 0, 40, 20, 0, 160, 16, 1.0); //jjPalette.gradient(200, 240, 60, 30, 30, 0, 176, 32, 1.0); //jjPalette.gradient(30, 30, 0, 200, 240, 0, 176, 32, 1.0); //jjPalette.gradient(100, 135, 170, 0, 0, 0, 208, 16, 1.0); for (int weaponID = WEAPON::BLASTER; weaponID <= WEAPON::GUN9; ++weaponID) { jjWEAPON@ weaponProfile = jjWeapons[weaponID]; weaponProfile.comesFromBirds = weaponProfile.comesFromBirdsPowerup = true; } jjObjectPresets[OBJECT::FASTFEET].points = 100; jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true; jjObjectPresets[OBJECT::SKELETON].behavior = TufturtleRic;//Tufturt itself (like some other enemies) doesn't cause ricochets. So I had to use sceleton instead. jjObjectPresets[OBJECT::SKELETON].scriptedCollisions = true; jjObjectPresets[OBJECT::SKELETON].determineCurAnim(ANIM::TUFTUR, 0); jjObjectPresets[OBJECT::SKELETON].xSpeed = 1; jjObjectPresets[OBJECT::SKELETON].energy = 8; jjObjectPresets[OBJECT::SKELETON].points = 600; //jjObjectPresets[OBJECT::SKELETON].killAnim=jjObjectPresets[OBJECT::SKELETON].determineCurAnim(ANIM::AMMO, 5); jjObjectPresets[OBJECT::TUFTURT].scriptedCollisions = true; } void onMain(){ //jjSetFadeColors(225,10,0); for (int q = 0; q < 1024; q++) { //loop through the global array jjParticles[1024] jjPARTICLE@ particle = jjParticles[q]; if (particle.type == PARTICLE::RAIN) { particle.xSpeed = 0; //make rain fall straight down particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed); //the rain speed accounts for differences in the player speed, and so won't appear to fall more slowly when the player is falling } } jjPalette.reset(); if (b<=99 && final && (jjGameTicks & 20) == 0) { b++; jjSetFadeColors(160-b,200-2*b,0); jjLocalPlayers[i].lighting = 98-b/10; jjPalette.reset(); jjPalette.copyFrom( 1, 254, 1, Boss, b/100.0 ); jjPalette.apply(); } else if (b==99) { Boss.apply(); } updateGems(); } const string MUSICFILENAME = "carrotus.j2b"; void onLevelReload() { jjPLAYER@ play = jjLocalPlayers[0]; jjLocalPlayers[i].lighting = 100; play.jumpStrength = -10; jjSetFadeColors(160,200,0); b=0; final=false; jjMusicLoad(MUSICFILENAME); jjPalette.reset(); } void onFunction1(jjPLAYER@ play) { jjTriggers[1]=true; } void onPlayerTimerEnd(jjPLAYER@ play) { play.jumpStrength = play.jumpStrength + 8; } void updateGems() { for(int i=1;i0) {boss.behave(BEHAVIOR::TUFBOSS);} else { a++; if (a==3) {play.showText("@Furry and furious!!", STRING::SMALL); @spawnedObject = jjObjects[jjAddObject(OBJECT::BOUNCEONCE, boss.xPos, boss.yPos)]; spawnedObject.determineCurAnim(ANIM::TUFBOSS, 2); jjSample(boss.xPos, boss.yPos, SOUND::MENUSOUNDS_SELECT0);} else if (a>=300) {jjEventSet(play.xPos / 32, play.yPos / 32, AREA::EOL);} } } void TufturtleRic (jjOBJ@ enemy) { jjPLAYER@ play = jjLocalPlayers[0]; if (enemy.state == STATE::START) { enemy.direction = enemy.xSpeed = 1; enemy.counter = (jjRandom()&45) + 70; enemy.state = STATE::WALK; } enemy.behave(BEHAVIOR::WALKINGENEMY); if (enemy.state == STATE::KILL) { KilledTUFTurts++; if (KilledTUFTurts==1) {play.showText("@Keep in mind that@ tuf turtles are invulnerable @to any physical attacks!", STRING::SMALL);} } } void onFunction2(jjPLAYER@ play) { Boss.load("CarrotSA9.j2t"); //jjSetFadeColors(225,10,0); final=true; } void onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) { if (obj.eventID == OBJECT::FASTFEET) { play.timerStart(2000/(jjDifficulty+1)); play.jumpStrength = play.jumpStrength - 8; play.showText("@Heigth of jumps @ temporarily increased!", STRING::SMALL); obj.behavior = BEHAVIOR::EXPLOSION2; //this is ESSENTIAL. just like enemies die by getting their states set to STATE::KILL, and bullets die by getting their states set to STATE::EXPLODE, pickups die by getting their behavior set to BEHAVIOR::EXPLOSION2. yes, sometimes a little consistency is in fact too much to ask for. obj.scriptedCollisions = false; //or obj.playerHandling = HANDLING::EXPLOSION; or something like that obj.frameID = 0; jjSample(obj.xPos, obj.yPos, SOUND::BUBBA_BUBBABOUNCE2); } else if (obj.eventID == OBJECT::SKELETON){ 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(2); //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+600; jjPARTICLE@ particle = jjAddParticle(PARTICLE::STRING); if (particle !is null) { particle.xPos = obj.xPos; particle.yPos = obj.yPos; particle.string.text = "600"; particle.ySpeed = -1.2; particle.xSpeed = -1.1; } } if (force == 0) {play.hurt();} else if (bullet.direction == obj.direction) { bullet.ricochet(); //obj.bulletHandling = HANDLING::DESTROYBULLET; obj.energy += 1; } else { //play.showText("It works!", STRING::SMALL); obj.energy -= 1; obj.justHit = 5; bullet.delete(); } } }