Downloads containing mo4a_FINALE.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.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 > 61*61)
  27. jjNxt(false, true);
  28.  
  29. }
  30.  
  31.  
  32. bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {return true;}
  33. bool onDrawLives(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  34. bool onDrawScore(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  35. bool onDrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas)   {return true;}
  36.  
  37. void onLevelLoad() {
  38.         jjLevelName = ("");
  39.  
  40.         jjObjectPresets[OBJECT::WATERSHIELD].determineCurAnim(ANIM::LORI, 45);
  41.         jjObjectPresets[OBJECT::WATERSHIELD].scriptedCollisions = true;
  42.  
  43.  
  44.         jjObjectPresets[OBJECT::FIRESHIELD].determineCurAnim(ANIM::SPAZ, 31);
  45.         jjObjectPresets[OBJECT::FIRESHIELD].scriptedCollisions = true;
  46.         jjObjectPresets[OBJECT::FIRESHIELD].direction = -1;
  47.  
  48.         jjObjectPresets[OBJECT::PLASMASHIELD].determineCurAnim(ANIM::QUEEN, 3);
  49.         jjObjectPresets[OBJECT::PLASMASHIELD].scriptedCollisions = true;
  50.         jjObjectPresets[OBJECT::PLASMASHIELD].direction = -1;
  51.  
  52.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].determineCurAnim(ANIM::JAZZ, 30);
  53.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].scriptedCollisions = true;
  54.         jjObjectPresets[OBJECT::BOUNCERPOWERUP].direction = -1;
  55.  
  56.         jjObjectPresets[OBJECT::SEEKERPOWERUP].determineCurAnim(ANIM::FLAG, 6);
  57.         jjObjectPresets[OBJECT::SEEKERPOWERUP].scriptedCollisions = true;
  58.         jjObjectPresets[OBJECT::SEEKERPOWERUP].direction = -1;
  59.  
  60.         jjObjectPresets[OBJECT::LASERSHIELD].determineCurAnim(ANIM::JAZZ, 14);
  61.         jjObjectPresets[OBJECT::LASERSHIELD].scriptedCollisions = true;
  62.         jjObjectPresets[OBJECT::LASERSHIELD].behavior = JazzShoots;
  63.         jjObjectPresets[OBJECT::LASERSHIELD].playerHandling = HANDLING::SPECIAL;
  64.  
  65.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::DEVILDEVAN, 21);
  66.         jjObjectPresets[OBJECT::TOASTERPOWERUP].scriptedCollisions = true;
  67.         jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = -1;
  68.         jjObjectPresets[OBJECT::TOASTERPOWERUP].playerHandling = HANDLING::ENEMY;
  69.         jjObjectPresets[OBJECT::TOASTERPOWERUP].bulletHandling = HANDLING::HURTBYBULLET;
  70.         jjObjectPresets[OBJECT::TOASTERPOWERUP].putOnGround(); 
  71.         jjObjectPresets[OBJECT::EVA].behavior = TimeMachine;
  72.         jjObjectPresets[OBJECT::EVA].determineCurAnim(ANIM::FLAG, 1);
  73.         jjObjectPresets[OBJECT::EVA].putOnGround(false);
  74.         jjObjectPresets[OBJECT::EVA].scriptedCollisions = true;
  75.         jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::EVA].curAnim];
  76.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  77.                 jjAnimFrames[tmAnim.firstFrame + i].coldSpotY = -44;
  78.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  79.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -64;
  80.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  81.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;
  82.  
  83.         jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
  84.         jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
  85.         jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
  86.         jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
  87.         for (uint i = 0; i < BAnim.frameCount; ++i)
  88.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotY = -85;
  89.         for (uint i = 0; i < BAnim.frameCount; ++i)
  90.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;
  91.  
  92.         jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
  93.         jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
  94.         jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
  95.         jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];
  96.  
  97.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  98.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 12;
  99.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  100.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;
  101.  
  102. }
  103.  
  104. void Bonuseye(jjOBJ@ obj){
  105.         obj.direction = -1;
  106.         obj.behave(BEHAVIOR::PICKUP, false);
  107.         obj.draw();
  108. }
  109. void Bonus(jjOBJ@ obj){
  110.         obj.putOnGround();
  111.         obj.direction = -1;
  112.         obj.behave(BEHAVIOR::PICKUP, false);
  113.         obj.draw();
  114. }
  115.  
  116. void TimeMachine(jjOBJ@ obj){
  117.         obj.behave(BEHAVIOR::EVA, false);
  118.                         jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);
  119.  
  120. }
  121.  
  122. void onFunction0(jjPLAYER@ p){
  123.         p.xPos = 28*32;
  124.         p.yPos = 1*32;
  125.         p.cameraFreeze(38*32, 0*32, true, false);
  126. }
  127. void onFunction1(jjPLAYER@ p){
  128. jjAddObject(OBJECT::BLASTERBULLET, 9*32, 9*32);
  129.  
  130. jjTriggers[1] = true;
  131. }
  132.  
  133. void onFunction2(jjPLAYER@ p){
  134.         p.cameraFreeze(0*32, 0*32, true, true);
  135. }
  136.  
  137. void JazzShoots(jjOBJ@ obj) {
  138. obj.behave(BEHAVIOR::MONITOR, false);
  139.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, SPRITE::NORMAL);
  140. }
  141.  
  142.  
  143.  
  144. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  145. class Sign {
  146.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  147.         private string text;
  148.         private uint widthOfText;
  149.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  150.         Sign(int xTile, int yTile, const string &in t) {
  151.                 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
  152.                 yPos = yTile * 32; //
  153.                 text = t;
  154.                 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.
  155.                 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.
  156.                 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.
  157.         }
  158.         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.
  159.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  160.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  161.         }
  162. }
  163. const array<Sign> Signs = {
  164.         Sign(8, 14, "Right on time! Jazz saves Ela!."),
  165.         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"),
  166. };
  167.  
  168. void onDrawLayer4(jjPLAYER@, jjCANVAS@ layer) {
  169.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  170.         for (uint signID = 0; signID < Signs.length; ++signID)
  171.                 Signs[signID].draw(layer, textIntensity);
  172.  
  173. }