Downloads containing xlmskywardl.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Skyward ShowdownFeatured Download PurpleJazz Capture the flag 9.1 Download file

File preview

  1. #pragma require "wind1.wav"
  2. #pragma require "SHIPHUMS.wav"
  3. #pragma require "xlmskywardex.j2l"
  4. #pragma require "xlmskywardex2.j2l"
  5.  
  6. bool gameIsActive() {
  7.         return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
  8. }
  9.  
  10. bool CTFMode() {
  11.         return (jjGameMode == GAME::CTF && jjGameCustom == GAME::NOCUSTOM) || jjGameCustom == GAME::DCTF;
  12. }
  13.  
  14. bool otherMode() {
  15.         return jjGameMode != GAME::CTF || jjGameCustom == GAME::TB || jjGameCustom == GAME::TLRS || jjGameCustom == GAME::DOM;
  16. }
  17.  
  18. bool muteAmbientWind() {
  19.         return (jjLocalPlayers[0].xPos < 22*32 && jjLocalPlayers[0].yPos < 46*32) || (jjLocalPlayers[0].xPos > 258*32 && jjLocalPlayers[0].yPos < 46*32);
  20. }
  21.  
  22. bool isWindSound(jjOBJ@ sound) {
  23.         return sound.xOrg >= 277*32;
  24. }
  25.  
  26. bool isShipSound(jjOBJ@ sound) {
  27.         return sound.xOrg <= 2*32;
  28. }
  29.  
  30. const array<uint16> invisibleTiles = {
  31.         75,
  32.         102, 103,
  33.         112, 113, 116, 117, 118, 119,
  34.         122, 123, 126, 127, 128, 129,
  35.         132, 133,
  36.         142, 143,
  37.         152, 153
  38. };
  39.  
  40. uint delay = 0;
  41.  
  42. void onLevelLoad() {
  43.         jjSampleLoad(SOUND::WIND_WIND2A, "wind1.wav");
  44.         jjSampleLoad(SOUND::SCIENCE_PLOPKAOS, "SHIPHUMS.wav");
  45.        
  46.         jjTexturedBGFadePositionY = 0.1;
  47.         jjUseLayer8Speeds = true;
  48.        
  49.         jjObjectPresets[OBJECT::LIGHTNINGSHIELD].behavior =
  50.         jjObjectPresets[OBJECT::RFPOWERUP].behavior = OscillatingMonitor();
  51.        
  52.         jjObjectPresets[OBJECT::AMBIENTSOUND].behavior = AmbientSound();
  53.        
  54.         jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
  55.        
  56.         jjLayerXOffset[6] = 128;
  57.        
  58.         array<jjLAYER@> extraLayers = jjLayersFromLevel("xlmskywardex.j2l", array<uint> = {1,2,3,5,6,7}, 0);
  59.         array<jjLAYER@> extraLayers2 = jjLayersFromLevel("xlmskywardex2.j2l", array<uint> = {1,2,3,4,5,6,7}, 0);
  60.         jjLayerOrderSet(array<jjLAYER@> = {extraLayers[0], extraLayers[1], extraLayers2[4], extraLayers2[5], extraLayers2[6], jjLayers[3], jjLayers[1], jjLayers[4], extraLayers2[0], extraLayers2[1], extraLayers2[2], extraLayers2[3], jjLayers[2], jjLayers[5], extraLayers[2], jjLayers[6], jjLayers[7], extraLayers[3], extraLayers[4], extraLayers[5], jjLayers[8]});
  61.        
  62.         extraLayers[1].spriteMode = SPRITE::TRANSLUCENTCOLOR;
  63.         extraLayers[1].spriteParam = 86;
  64.        
  65.         extraLayers[2].xOffset = 100;
  66.         extraLayers[2].yOffset = 360;
  67.         extraLayers[3].xOffset = 80;
  68.         extraLayers[3].yOffset = 120;
  69.         extraLayers[4].xOffset = 160;
  70.         extraLayers[4].yOffset = 140;
  71.         extraLayers[5].xOffset = 320;
  72.         extraLayers[5].yOffset = 160;
  73.        
  74.         extraLayers2[4].xOffset = 200;
  75.         extraLayers2[4].yOffset = -1700;
  76.         extraLayers2[5].xOffset = 300;
  77.         extraLayers2[5].yOffset = -1600;
  78.         extraLayers2[6].xOffset = 400;
  79.         extraLayers2[6].yOffset = -1500;
  80.        
  81.         for (uint16 i = 0; i < invisibleTiles.length(); i++) {
  82.                 jjTileType[invisibleTiles[i]] = 3; //invisible
  83.         }
  84.         jjTileType[1176] = 5;
  85. }
  86.  
  87. class OscillatingMonitor : jjBEHAVIORINTERFACE {
  88.         void onBehave(jjOBJ@ obj) {
  89.                 obj.behave(BEHAVIOR::MONITOR);
  90.                 obj.xPos = obj.xOrg - 4;
  91.                 obj.yPos = (obj.yOrg + 2) - jjLayerYOffset[2];
  92.                 obj.direction = -1;
  93.         }
  94. }
  95.  
  96. class AmbientSound : jjBEHAVIORINTERFACE {
  97.         void onBehave(jjOBJ@ sound) {
  98.                 sound.behave(jjLowDetail && jjGameTicks >= 2? BEHAVIOR::INACTIVE : BEHAVIOR::AMBIENTSOUND, false);
  99.                 if (jjLocalPlayers[0].health > 0) delay++;
  100.                 else delay = 0;
  101.                
  102.                 if (jjTriggers[19] && isWindSound(sound) && delay >= 35) {
  103.                         loopSound(sound);
  104.                 }
  105.                 if (!jjTriggers[19] && isShipSound(sound) && delay >= 35) {
  106.                         loopSound(sound);
  107.                 }
  108.        
  109.                 if ((muteAmbientWind() && isWindSound(sound)) || jjLocalPlayers[0].health == 0) {
  110.                         jjTriggers[19] = false;
  111.                         sound.xPos = sound.xOrg;
  112.                         sound.yPos = sound.yOrg;
  113.                 }
  114.         }
  115. }
  116.  
  117. void loopSound(jjOBJ@ sound) {
  118.         sound.xPos = jjLocalPlayers[0].xPos;
  119.         sound.yPos = jjLocalPlayers[0].yPos;
  120. }
  121.  
  122. void onPlayer(jjPLAYER@ play) {
  123.         if (play.shieldTime > 15*70) play.shieldTime = 15*70;
  124.        
  125.         play.lightType = LIGHT::NONE;
  126.        
  127.         if (play.fly == FLIGHT::AIRBOARD && play.timerState == TIMER::STOPPED) play.timerStart(20*70);
  128.         if (play.fly == FLIGHT::NONE) play.timerStop();
  129.         if (play.timerState == TIMER::STARTED && play.timerTime <= 3*70 && play.timerTime > 0 && play.timerTime % 70 == 0) jjSamplePriority(SOUND::COMMON_NOCOIN);
  130. }
  131.  
  132. void onPlayerTimerEnd(jjPLAYER@ play) { play.fly = FLIGHT::NONE; }
  133.  
  134. void onMain() {
  135.         if (!jjLowDetail) {
  136.                 jjLayerYOffset[1] = jjCos(jjGameTicks*8)*4;
  137.                 jjLayerYOffset[2] = jjCos(jjGameTicks*8)*4;
  138.         } else {
  139.                 jjLayerYOffset[1] =
  140.                 jjLayerYOffset[2] = 0;
  141.         }
  142.        
  143.         array<jjLAYER@> layers = jjLayerOrderGet();
  144.         layers[0].hasTiles = layers[1].hasTiles = false;
  145.         layers[8].xOffset = jjSin(jjGameTicks*48)*8;
  146.         layers[9].xOffset = -jjSin(jjGameTicks*48)*8;
  147.         layers[10].yOffset = jjCos(jjGameTicks*48)*8;
  148.         layers[11].yOffset = -jjCos(jjGameTicks*48)*8;
  149. }
  150.  
  151. bool onDrawPlayerTimer(jjPLAYER@ play, jjCANVAS@ canvas) {
  152.         if (play.fly == FLIGHT::AIRBOARD) {
  153.         canvas.drawString(
  154.                         jjSubscreenWidth - 75,
  155.                 jjSubscreenHeight - 284,
  156.                 "" + (play.timerTime > 0? (play.timerTime + 70) / 70 : 0),
  157.                 STRING::LARGE,
  158.                 STRING::PALSHIFT,
  159.                 play.timerTime > 3*70?
  160.                 24 :
  161.                 jjGameTicks % 28 > 14?
  162.                 -40 :
  163.                 -24
  164.                 );
  165.                
  166.                 canvas.drawSprite(
  167.                         jjSubscreenWidth - 92,
  168.                         jjSubscreenHeight - 280,
  169.                         ANIM::PICKUPS,
  170.                         36,
  171.                         jjGameTicks / 6 % 8
  172.                 );
  173.         }
  174.         return true;
  175. }
  176.  
  177. void onFunction0(jjPLAYER@ play) {
  178.         play.showText("@@@@Skyward Showdown@Created by PurpleJazz of XLM (2009-2017)@Tileset by BlurredD@np: Kevin Riepl - Skyscraper [2:01]");
  179. }