Downloads containing mo4a_FINALE_123.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Mystery of the Four... chandie Single player 6.6 Download file

File preview

  1. const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5.asc" ///@MLLE-Generated
  3. #pragma require "mo4a_FINALE_123.j2l" ///@MLLE-Generated
  4.  
  5. void onPlayer(jjPLAYER@ p) {
  6.         p.direction = 1;
  7.         p.lightType = LIGHT::NONE;
  8.         p.idle = 100;
  9.         p.keyRun = false;
  10.         p.keyLeft = false;
  11.         p.lightType = LIGHT::NONE;
  12.         p.keyUp = false;
  13.         p.keyDown = false;
  14.         p.keyRight = false;
  15.  
  16.  
  17. if(p.keyFire && jjGameTicks > 5*61)
  18. jjNxt(false, true);
  19.  
  20. if(p.keyJump && jjGameTicks > 5*61)
  21. jjNxt(false, true);
  22.  
  23. if(p.keySelect && jjGameTicks > 5*61)
  24. jjNxt(false, true);
  25.  
  26. if(jjGameTicks > 62*61)
  27. jjNxt(false, true);
  28. }
  29.  
  30.  
  31. bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {return true;}
  32. bool onDrawLives(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  33. bool onDrawScore(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  34. bool onDrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas)   {return true;}
  35.  
  36. void onLevelLoad() {
  37.         jjLevelName = ("");
  38.  
  39.         jjObjectPresets[OBJECT::WATERSHIELD].determineCurAnim(ANIM::LORI, 45);
  40.         jjObjectPresets[OBJECT::WATERSHIELD].scriptedCollisions = true;
  41.  
  42.  
  43.         jjObjectPresets[OBJECT::FIRESHIELD].determineCurAnim(ANIM::SPAZ, 31);
  44.         jjObjectPresets[OBJECT::FIRESHIELD].scriptedCollisions = true;
  45.         jjObjectPresets[OBJECT::FIRESHIELD].direction = -1;
  46.  
  47.         jjObjectPresets[OBJECT::PLASMASHIELD].determineCurAnim(ANIM::QUEEN, 3);
  48.         jjObjectPresets[OBJECT::PLASMASHIELD].scriptedCollisions = true;
  49.         jjObjectPresets[OBJECT::PLASMASHIELD].direction = -1;
  50.  
  51.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].determineCurAnim(ANIM::JAZZ, 30);
  52.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].scriptedCollisions = true;
  53.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
  54.  
  55.         jjObjectPresets[OBJECT::SEEKERPOWERUP].determineCurAnim(ANIM::FLAG, 6);
  56.         jjObjectPresets[OBJECT::SEEKERPOWERUP].scriptedCollisions = true;
  57.         jjObjectPresets[OBJECT::SEEKERPOWERUP].direction = -1;
  58.  
  59.         jjObjectPresets[OBJECT::LASERSHIELD].determineCurAnim(RABBIT::FIRE, 0);
  60.         jjObjectPresets[OBJECT::LASERSHIELD].scriptedCollisions = true;
  61.         jjObjectPresets[OBJECT::LASERSHIELD].behavior = JazzShoots;
  62.         jjObjectPresets[OBJECT::LASERSHIELD].playerHandling = HANDLING::SPECIAL;
  63.  
  64.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::DEVILDEVAN, 21);
  65.         jjObjectPresets[OBJECT::TOASTERPOWERUP].scriptedCollisions = true;
  66.         jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = -1;
  67.         jjObjectPresets[OBJECT::TOASTERPOWERUP].playerHandling = HANDLING::ENEMY;
  68.         jjObjectPresets[OBJECT::TOASTERPOWERUP].bulletHandling = HANDLING::HURTBYBULLET;
  69.         jjObjectPresets[OBJECT::TOASTERPOWERUP].putOnGround(); 
  70.         jjObjectPresets[OBJECT::EVA].behavior = TimeMachine;
  71.         jjObjectPresets[OBJECT::EVA].determineCurAnim(ANIM::FLAG, 1);
  72.         jjObjectPresets[OBJECT::EVA].putOnGround(false);
  73.         jjObjectPresets[OBJECT::EVA].scriptedCollisions = true;
  74.         jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::EVA].curAnim];
  75.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  76.                 jjAnimFrames[tmAnim.firstFrame + i].coldSpotY = -44;
  77.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  78.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -64;
  79.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  80.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;
  81.  
  82.         jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
  83.         jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
  84.         jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
  85.         jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
  86.         for (uint i = 0; i < BAnim.frameCount; ++i)
  87.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotY = -85;
  88.         for (uint i = 0; i < BAnim.frameCount; ++i)
  89.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;
  90.  
  91.         jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
  92.         jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
  93.         jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
  94.         jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];
  95.  
  96.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  97.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 12;
  98.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  99.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;
  100.  
  101. }
  102.  
  103. void Bonuseye(jjOBJ@ obj){
  104.         obj.direction = -1;
  105.         obj.behave(BEHAVIOR::PICKUP, false);
  106.         obj.draw();
  107. }
  108. void Bonus(jjOBJ@ obj){
  109.         obj.putOnGround();
  110.         obj.direction = -1;
  111.         obj.behave(BEHAVIOR::PICKUP, false);
  112.         obj.draw();
  113. }
  114.  
  115. void TimeMachine(jjOBJ@ obj){
  116.         obj.behave(BEHAVIOR::EVA, false);
  117.                         jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);
  118.  
  119. }
  120.  
  121. void onFunction0(jjPLAYER@ p){
  122.         p.xPos = 28*32;
  123.         p.yPos = 1*32;
  124.         p.cameraFreeze(38*32, 0*32, true, false);
  125. }
  126. void onFunction1(jjPLAYER@ p){
  127. jjAddObject(OBJECT::BLASTERBULLET, 9*32, 9*32);
  128.  
  129. jjTriggers[1] = true;
  130. }
  131.  
  132. void onFunction2(jjPLAYER@ p){
  133.         p.cameraFreeze(0*32, 0*32, true, true);
  134. }
  135.  
  136. void JazzShoots(jjOBJ@ obj) {
  137. obj.behave(BEHAVIOR::MONITOR, false);
  138.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, SPRITE::NORMAL);
  139. }
  140.  
  141.  
  142.  
  143. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  144. class Sign {
  145.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  146.         private string text;
  147.         private uint widthOfText;
  148.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  149.         Sign(int xTile, int yTile, const string &in t) {
  150.                 xPos = xTile * 32; //Since this is a constant operation, it could strictly be performed in the draw method instead of the constructor, but this way involves fewer multiplication instructions
  151.                 yPos = yTile * 32; //
  152.                 text = t;
  153.                 SignTextAppearance.newline = STRING::SPECIALSIGN; //Causes the drawString method to interpret instances of the \n character as signals to drop down to a new line, similar to the special effect of the @ character in the STRING::SPIN appearance.
  154.                 SignTextAppearance.spacing = -2; //int jjTEXTAPPEARANCE::spacing is new in 5.2, and this particular value is equivalent to prefixing the string with "ยง2". Make sure to check out bool jjTEXTAPPEARANCE::monospace too, though it didn't end up getting used in this level.
  155.                 widthOfText = jjGetStringWidth(text, STRING::SMALL, SignTextAppearance); //Used for determining how large of a dark rectangle should be drawn behind the text. A matching heightOfText value could of course be generated by counting the number of newline characters--for example, "heightOfText = text.split("\n").length * 20;"--but here the rectangles are constant height instead to limit the temptation to ramble on and on.
  156.         }
  157.         void draw(jjCANVAS@ layer, uint8 textIntensity) const { //Because this method will be called from an onDraw method, it's important to have a jjCANVAS@ passed among the arguments.
  158.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  159.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  160.         }
  161. }
  162. const array<Sign> Signs = {
  163.         Sign(8, 14, "Right on time! Jazz saves Ela!."),
  164.         Sign(32, 14, "With Ela is back and Devan and the Demons are\ngone for good, it's time for Jackrabbits to live in peace.\n\n||||THE END"),
  165. };
  166.  
  167. void onDrawLayer4(jjPLAYER@, jjCANVAS@ layer) {
  168.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  169.         for (uint signID = 0; signID < Signs.length; ++signID)
  170.                 Signs[signID].draw(layer, textIntensity);
  171.  
  172. }