Downloads containing mo4a_intro_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_intro_123.j2l" ///@MLLE-Generated
  4. void onPlayer(jjPLAYER@ p) {
  5.  
  6.         p.lightType = LIGHT::NONE;
  7.         p.idle = 100;
  8.         p.keyRun = false;
  9.         p.keyLeft = false;
  10.         p.lightType = LIGHT::NONE;
  11.         p.keyUp = false;
  12.         p.keyDown = false;
  13.         p.keyRight = false;
  14.  
  15. if(p.keyFire && jjGameTicks > 5*61)
  16. jjNxt(false, true);
  17.  
  18. if(p.keyJump && jjGameTicks > 5*61)
  19. jjNxt(false, true);
  20.  
  21. if(p.keySelect && jjGameTicks > 5*61)
  22. jjNxt(false, true);
  23.  
  24. if(jjGameTicks > 62*61)
  25. jjNxt(false, true);
  26. }
  27.  
  28.  
  29. bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {return true;}
  30. bool onDrawLives(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  31. bool onDrawScore(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  32. bool onDrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas)   {return true;}
  33.  
  34. void onLevelLoad() {
  35.  
  36.         jjLevelName = ("");
  37.  
  38.         p.cameraFreeze(0*32, 0*32, true, false);
  39.  
  40.         jjObjectPresets[OBJECT::WATERSHIELD].determineCurAnim(ANIM::LORI, 30);
  41.         jjObjectPresets[OBJECT::WATERSHIELD].scriptedCollisions = true;
  42.  
  43.  
  44.         jjObjectPresets[OBJECT::FIRESHIELD].determineCurAnim(ANIM::SPAZ, 57);
  45.         jjObjectPresets[OBJECT::FIRESHIELD].scriptedCollisions = true;
  46.         jjObjectPresets[OBJECT::FIRESHIELD].direction = -1;
  47.  
  48.         jjObjectPresets[OBJECT::PLASMASHIELD].determineCurAnim(ANIM::QUEEN, 0);
  49.         jjObjectPresets[OBJECT::PLASMASHIELD].scriptedCollisions = true;
  50.         jjObjectPresets[OBJECT::PLASMASHIELD].direction = -1;
  51.  
  52.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(RABBIT::STAND, 65);
  53.         jjObjectPresets[OBJECT::TOASTERPOWERUP].scriptedCollisions = true;
  54.         jjObjectPresets[OBJECT::TOASTERPOWERUP].direction = -1;
  55.  
  56.  
  57. }
  58.  
  59. void onFunction0(jjPLAYER@ p){
  60.         p.xPos = 28*32;
  61.         p.yPos = 1*32;
  62.         p.cameraFreeze(38*32, 2*32, true, false);
  63. }
  64.  
  65.  
  66. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  67. class Sign {
  68.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  69.         private string text;
  70.         private uint widthOfText;
  71.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  72.         Sign(int xTile, int yTile, const string &in t) {
  73.                 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
  74.                 yPos = yTile * 32; //
  75.                 text = t;
  76.                 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.
  77.                 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.
  78.                 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.
  79.         }
  80.         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.
  81.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  82.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  83.         }
  84. }
  85. const array<Sign> Signs = {
  86.         Sign(3, 15, "Jazz and Eva's daughter Ela was murdered by Devan Shell.\nDevan somehow managed to sneak into the castle, and killed the poor girl."),
  87.         Sign(30, 14, "Everybody was upset during the funeral. Though Merlin the Wizard offered\nto use Devan's time machine to go back in time and save Ela. He sent a letter\nto an ex ward of his, Bonus, asking for help in order to get the machine work.\n\nHit ||||||||SPACE |or ||||||||JUMP |to ||||||||START |."),
  88. };
  89.  
  90. void onDrawLayer4(jjPLAYER@, jjCANVAS@ layer) {
  91.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  92.         for (uint signID = 0; signID < Signs.length; ++signID)
  93.                 Signs[signID].draw(layer, textIntensity);
  94.  
  95. }