Downloads containing xlmpolaris.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: PolarisFeatured Download PurpleJazz Capture the flag 8.9 Download file
TSF with JJ2+ Only: PolarisFeatured Download PurpleJazz Capture the flag 8.9 Download file

File preview

  1. #pragma require "LaserBlaster.j2a"
  2. #pragma require "xlmpolaris_sounds/amb_cmdd.wav"
  3. #pragma require "xlmpolaris_sounds/amb_puls.wav"
  4. #pragma require "xlmpolaris_sounds/f_laser1.wav"
  5. #pragma require "xlmpolaris_sounds/f_laser2.wav"
  6. #pragma require "xlmpolaris_sounds/f_laser3.wav"
  7. #pragma require "xlmpolaris_sounds/f_laser4.wav"
  8. #pragma require "xlmpolaris_sounds/fan_sm4.wav"
  9. #pragma require "xlmpolaris_sounds/mawaters.wav"
  10. #pragma require "xlmpolaris_sounds/mloop2.wav"
  11. #pragma require "xlmpolaris_sounds/splash01.wav"
  12.  
  13. void onLevelLoad() {
  14.         jjAnimSets[ANIM::CUSTOM[0]].load(0, "LaserBlaster.j2a");
  15.         jjAnimations[jjAnimSets[ANIM::AMMO] + 29] = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + 2];
  16.         jjAnimations[jjAnimSets[ANIM::AMMO] + 28] = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + 3];
  17.         jjAnimations[jjAnimSets[ANIM::PICKUPS] + 62] = jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + 4];
  18.        
  19.         for (int i = 1; i < 255; i++) {
  20.                 if (jjObjectPresets[i].playerHandling == HANDLING::PICKUP) {
  21.                         jjObjectPresets[i].behavior = CannotBeBuried;
  22.                 }
  23.         }
  24.        
  25.         jjObjectPresets[OBJECT::ICEBULLET].behavior = LaserGun;
  26.         jjObjectPresets[OBJECT::ICEBULLET].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::CUSTOM[0], 0);
  27.         jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 1.5;
  28.         jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 125;
  29.         jjObjectPresets[OBJECT::ICEBULLET].freeze = 0;
  30.         jjObjectPresets[OBJECT::ICEBULLET].eventID = OBJECT::FIREBALLBULLET;
  31.         jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
  32.  
  33.         jjObjectPresets[OBJECT::ICEBULLETPU].behavior = LaserGunPU;
  34.         jjObjectPresets[OBJECT::ICEBULLETPU].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::CUSTOM[0], 1);
  35.         jjObjectPresets[OBJECT::ICEBULLETPU].xSpeed = 2;
  36.         jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = 95;
  37.         jjObjectPresets[OBJECT::ICEBULLETPU].var[6] = 8;
  38.         jjObjectPresets[OBJECT::ICEBULLETPU].freeze = 0;
  39.         jjObjectPresets[OBJECT::ICEBULLETPU].eventID = OBJECT::FIREBALLBULLETPU;
  40.         jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
  41.        
  42.         jjObjectPresets[OBJECT::ICEPOWERUP].determineCurAnim(ANIM::CUSTOM[0], 4, true);
  43.         jjObjectPresets[OBJECT::ICEPOWERUP].determineCurFrame();
  44.        
  45.         jjWeapons[WEAPON::ICE].spread = SPREAD::NORMAL;
  46.        
  47.         jjSampleLoad(SOUND::P2_POEP, "xlmpolaris_sounds/amb_cmdd.wav");
  48.         jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "xlmpolaris_sounds/amb_puls.wav");
  49.         jjSampleLoad(SOUND::WIND_WIND2A, "xlmpolaris_sounds/fan_sm4.wav");
  50.         jjSampleLoad(SOUND::COMMON_COLLAPS, "xlmpolaris_sounds/mawaters.wav");
  51.         jjSampleLoad(SOUND::COMMON_DRINKSPAZZ3, "xlmpolaris_sounds/mloop2.wav");
  52.         jjSampleLoad(SOUND::COMMON_WATER, "xlmpolaris_sounds/splash01.wav");
  53.         jjSampleLoad(SOUND::AMMO_ICEGUN, "xlmpolaris_sounds/f_laser1.wav");
  54.         jjSampleLoad(SOUND::AMMO_ICEGUN2, "xlmpolaris_sounds/f_laser2.wav");
  55.         jjSampleLoad(SOUND::AMMO_ICEGUNPU, "xlmpolaris_sounds/f_laser2.wav");
  56.         jjSampleLoad(SOUND::AMMO_ICEPU1, "xlmpolaris_sounds/f_laser3.wav");
  57.         jjSampleLoad(SOUND::AMMO_ICEPU2, "xlmpolaris_sounds/f_laser3.wav");
  58.         jjSampleLoad(SOUND::AMMO_ICEPU3, "xlmpolaris_sounds/f_laser4.wav");
  59.         jjSampleLoad(SOUND::AMMO_ICEPU4, "xlmpolaris_sounds/f_laser4.wav");
  60.        
  61.         jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 82];
  62.         for (uint i = 0; i < anim.frameCount; ++i) {
  63.                 jjANIMFRAME@ frame = jjAnimFrames[anim + i];
  64.                 jjPIXELMAP sprite(frame);
  65.                 for (uint x = 0; x < sprite.width; ++x)
  66.                         for (uint y = 0; y < sprite.height; ++y)
  67.                         if (sprite[x,y] != 0 && sprite[x,y] != 15) sprite[x,y] += 33;
  68.                 sprite.save(frame);
  69.         }
  70.        
  71.         jjPIXELMAP VFlippedSign(634);
  72.         VFlippedSign.save(634 | TILE::VFLIPPED, true);
  73. }
  74.  
  75. void CannotBeBuried(jjOBJ@ obj) {
  76.         obj.behave(BEHAVIOR::PICKUP);
  77.         if (jjMaskedPixel(int(obj.xPos), int(obj.yPos) + 8)) {
  78.                 obj.state = STATE::FLOAT;
  79.         }
  80.         if (obj.eventID == OBJECT::CARROT) {
  81.                 obj.xPos = obj.xOrg - 16;
  82.                 if (obj.state == STATE::FLOATFALL) obj.state = STATE::FLOAT; //can't be shot down
  83.         }
  84.         else if (obj.eventID == OBJECT::FLYCARROT) {
  85.                 if (jjLocalPlayers[0].fly == FLIGHT::FLYCARROT) obj.playerHandling = HANDLING::PARTICLE;
  86.                 else obj.playerHandling = HANDLING::PICKUP;
  87.         }
  88.         if (obj.ySpeed < 0) obj.ySpeed = 0.25;
  89. }
  90.  
  91. void LaserGun(jjOBJ@ obj) {
  92.         jjPLAYER@ creator = jjPlayers[obj.creatorID];
  93.         if (obj.state == STATE::START) {
  94.                 obj.state = STATE::FLY;
  95.                 obj.direction = creator.direction;
  96.         }
  97.         if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
  98.                 obj.xSpeed = -obj.xSpeed;
  99.                 obj.var[7] = -obj.var[7];
  100.                 obj.xAcc = -obj.xAcc;
  101.                 obj.ySpeed -= 1.5;
  102.                 obj.counter -= 5;
  103.                 if (obj.state == STATE::FLY) randomSample(obj);
  104.         }
  105.         else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
  106.                 obj.ySpeed = -obj.ySpeed;
  107.                 obj.yAcc = -obj.yAcc;
  108.                 obj.xSpeed -= obj.direction == 1? -1.5:1.5;
  109.                 obj.counter -= 5;
  110.                 if (obj.state == STATE::FLY) randomSample(obj);
  111.         }
  112.         obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
  113.         if (obj.state == STATE::FLY) jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[0], 1, 0, obj.var[0], 0.9, 0.9, SPRITE::NORMAL);
  114.         obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
  115. }
  116.  
  117. void LaserGunPU(jjOBJ@ obj) {
  118.         jjPLAYER@ creator = jjPlayers[obj.creatorID];
  119.         if (obj.state == STATE::START) {
  120.                 obj.state = STATE::FLY;
  121.                 obj.direction = creator.direction;
  122.         }
  123.         if (jjMaskedPixel(int(obj.xPos + obj.xSpeed + obj.var[7] / 65536.f), int(obj.yPos))) {
  124.                 obj.xSpeed = -obj.xSpeed;
  125.                 obj.var[7] = -obj.var[7];
  126.                 obj.xAcc = -obj.xAcc;
  127.                 obj.ySpeed -= 3;
  128.                 obj.counter -= 5;
  129.                 if (obj.state == STATE::FLY) randomSample(obj);
  130.         }
  131.         else if (jjMaskedPixel(int(obj.xPos), int(obj.yPos + obj.ySpeed))) {
  132.                 obj.ySpeed = -obj.ySpeed;
  133.                 obj.yAcc = -obj.yAcc;
  134.                 obj.xSpeed -= obj.direction == 1? -3:3;
  135.                 obj.counter -= 5;
  136.                 if (obj.state == STATE::FLY) randomSample(obj);
  137.         }
  138.         obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
  139.        
  140.         if (obj.state == STATE::FLY) jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[0], 0, 0, obj.var[0], 1, 1, SPRITE::NORMAL);
  141.         obj.behave(BEHAVIOR::BULLET, obj.state == STATE::FLY? false:true);
  142. }
  143.  
  144. void randomSample(jjOBJ@ obj) {
  145.         switch(jjRandom()%4) {
  146.                 case 0: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BUL1, 0, 0); break;
  147.                 case 1: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL1, 0, 0); break;
  148.                 case 2: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL2, 0, 0); break;
  149.                 case 3: jjSample(obj.xPos, obj.yPos, SOUND::AMMO_BULFL3, 0, 0); break;
  150.         }
  151. }
  152.  
  153. void onPlayer(jjPLAYER@ play) {
  154.         if (play.fly == FLIGHT::FLYCARROT && play.timerState == TIMER::STOPPED) play.timerStart(7*70);
  155.         if (play.fly == FLIGHT::NONE) play.timerStop();
  156.         if (play.timerState == TIMER::STARTED && play.timerTime <= 3*70 && play.timerTime > 0 && play.timerTime % 70 == 0) jjSamplePriority(SOUND::COMMON_NOCOIN);
  157.         if (play.timerTime == 0) play.fly = FLIGHT::NONE;
  158.        
  159.         if (jjGameState == GAME::PAUSED) play.timerPause();
  160.         else play.timerResume();
  161.        
  162.         play.lighting = 80;
  163.        
  164.         if (!jjLowDetail) {
  165.                 if (jjGameTicks % 410 == 0 || jjGameTicks == 1) jjSample(jjLocalPlayers[0].xPos, jjLocalPlayers[0].yPos, SOUND::P2_POEP, (jjMusicActive && jjMusicVolume > 0)? 16:48, 0);
  166.         }
  167. }
  168.  
  169. void onPlayerTimerEnd(jjPLAYER@ play) { play.fly = FLIGHT::NONE; }
  170.  
  171. bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) {
  172.         if (play.fly == FLIGHT::FLYCARROT) {
  173.                 canvas.drawString(
  174.                         jjSubscreenWidth - 55,
  175.                         jjSubscreenHeight - 284,
  176.                         "" + (play.timerTime + 70) / 70,
  177.                         STRING::LARGE,
  178.                         STRING::PALSHIFT,
  179.                         play.timerTime > 3*70?
  180.                                 0 :
  181.                                 jjGameTicks % 28 > 14?
  182.                                         -40 :
  183.                                         -24
  184.                 );
  185.                
  186.                 canvas.drawSprite(
  187.                         jjSubscreenWidth - 72,
  188.                         jjSubscreenHeight - 270,
  189.                         ANIM::PICKUPS,
  190.                         40,
  191.                         jjGameTicks >> 2
  192.                 );
  193.         }
  194.         return true;
  195. }
  196.  
  197. void onFunction0(jjPLAYER@ play) {
  198.         play.showText("@@@@@Polaris@Created by PurpleJazz of XLM (2007-2017)@Tileset by cooba, edited by PurpleJazz@Space background texture by Vurt@Ambient sound effects by Eric Brosius@np: Michiel van den Bos - Far Under [4:14]");
  199. }
  200.  
  201. void onFunction1(jjPLAYER@ play) {
  202.         play.showText("@@@@Spawn Times@Ammo: 15@+1 Carrots: 20@Full NRG: 25@Bouncer/Laser Powerups: 25@RF Powerup: 30");
  203. }