Downloads containing ezmoon.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: MoonriseFeatured Download PurpleJazz Battle 9.1 Download file

File preview

  1. const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5.asc" ///@MLLE-Generated
  3. #pragma require "ezmoon-MLLE-Data-1.j2l" ///@MLLE-Generated
  4. #pragma require "ezmoon.j2l" ///@MLLE-Generated
  5. #pragma require "spelunky_ignite.wav"
  6.  
  7. void onLevelLoad() {
  8.         jjTexturedBGFadePositionX = 0.225;
  9.         jjTexturedBGFadePositionY = 0.355;
  10.         jjUseLayer8Speeds = true;
  11.        
  12.         for (int i = 1; i < 255; i++) {
  13.                 jjOBJ@ preset = jjObjectPresets[i];
  14.                 if (preset.playerHandling == HANDLING::PICKUP) {
  15.                         preset.behavior = CannotBeShotDown(preset.behavior);
  16.                 }
  17.         }
  18.        
  19.         jjSampleLoad(SOUND::P2_POEP, "spelunky_ignite.wav");
  20.        
  21.         generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[0]], array<uint> = {113});
  22.         turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 27.5f, false);
  23. }
  24.  
  25. class CannotBeShotDown : jjBEHAVIORINTERFACE {
  26.         CannotBeShotDown(const jjBEHAVIOR &in behavior) {
  27.                 originalBehavior = behavior;
  28.         }
  29.         void onBehave(jjOBJ@ obj) {
  30.                 obj.behave(originalBehavior);
  31.                 if (obj.state == STATE::FLOATFALL)
  32.                         obj.state = STATE::FLOAT;
  33.         }
  34.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  35.                 if (bullet is null) {
  36.                         obj.behavior = originalBehavior;
  37.                         if (player.objectHit(obj, force, obj.playerHandling))
  38.                                 return true;
  39.                         obj.behavior = this;
  40.                 }
  41.                 return false;
  42.         }
  43.         private jjBEHAVIOR originalBehavior;
  44. }
  45.  
  46. jjANIMSET@ customSpringSprite;
  47. array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
  48. bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
  49.         int length = colors.length();
  50.         bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
  51.         if (success) {
  52.                 uint srcSet = jjAnimSets[ANIM::SPRING];
  53.                 for (int i = 0; i < length; i++) {
  54.                         uint color = colors[i];
  55.                         uint destAnimOffset = anim + i * 3;
  56.                         for (int j = 0; j < 3; j++) {
  57.                                 uint srcAnim = jjAnimations[srcSet + j];
  58.                                 uint destAnim = jjAnimations[destAnimOffset + j];
  59.                                 for (int k = 0; k < 5; k++) {
  60.                                         jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
  61.                                         int width = image.width;
  62.                                         int height = image.height;
  63.                                         for (int l = 0; l < height; l++) {
  64.                                                 for (int m = 0; m < width; m++) {
  65.                                                         int pixel = image[m, l];
  66.                                                         if (pixel >= 32 && pixel < 40)
  67.                                                                 image[m, l] = color + (pixel & 7);
  68.                                                 }
  69.                                         }
  70.                                         if (!image.save(jjAnimFrames[destAnim + k]))
  71.                                                 return false;
  72.                                 }
  73.                         }
  74.                 }
  75.         }
  76.         return success;
  77. }
  78. void initializeCustomSpring(jjOBJ@ obj) {
  79.         int anim = obj.curAnim;
  80.         obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
  81.         if (obj.curAnim != anim) {
  82.                 obj.curAnim = anim + 2;
  83.                 obj.determineCurFrame();
  84.         }
  85.         obj.draw();
  86. }
  87. void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
  88.         if (horizontal) {
  89.                 obj.xSpeed = power;
  90.                 obj.ySpeed = 0.f;
  91.         } else {
  92.                 obj.xSpeed = 0.f;
  93.                 obj.ySpeed = -power;
  94.                 if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
  95.                         int x = int(obj.xPos) >> 5;
  96.                         int y = int(obj.yPos) >> 5;
  97.                         if (jjParameterGet(x, y, 0, 1) != 0) {
  98.                                 jjParameterSet(x, y, 0, 1, 0);
  99.                                 obj.yPos -= 4.f;
  100.                                 obj.ySpeed = power;
  101.                         }
  102.                 }
  103.         }
  104.         obj.behavior = initializeCustomSpring;
  105.         obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
  106.         obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
  107.         obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
  108.         obj.deactivates = obj.isFreezable = true;
  109.         obj.bulletHandling = HANDLING::IGNOREBULLET;
  110.         obj.playerHandling = HANDLING::SPECIAL;
  111.         obj.lightType = LIGHT::NORMAL;
  112.         obj.determineCurFrame();
  113. }
  114.  
  115. void onPlayer(jjPLAYER@ play) {
  116.         if (play.yPos >= 0) {
  117.                 int skill = jjParameterGet(uint16(play.xPos/32), uint16(play.yPos/32), -4, 2); 
  118.                 if (skill == 3) {
  119.                         if (jjLayers[2].spriteParam > 64) {
  120.                                 if (jjLayers[2].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP);
  121.                                 jjLayers[2].spriteParam = jjLayers[2].spriteParam - 10;
  122.                         }
  123.                 }
  124.                 else if (jjLayers[2].spriteParam != 255) {
  125.                         jjLayers[2].spriteParam = jjLayers[2].spriteParam + 10;
  126.                 }
  127.         }
  128. }
  129.  
  130. void onMain() {
  131.         array<jjLAYER@> layers = jjLayerOrderGet();
  132.         layers[13].spriteMode = jjColorDepth == 16? SPRITE::BRIGHTNESS : SPRITE::NORMAL;
  133. }