Downloads containing mo4a_2_cutscene.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.  
  2.  
  3. void onPlayer(jjPLAYER@ p) {
  4.         p.idle = 100;
  5.         p.keyRun = false;
  6.         p.keyLeft = false;
  7.         p.lightType = LIGHT::NONE;
  8.         p.keyUp = false;
  9.         p.keyDown = false;
  10.         p.keyRight = false;
  11.         p.cameraFreeze(0*32, 0*32, true, false);
  12.  
  13. if(p.keyFire)
  14. jjNxt(false, true);
  15.  
  16. if(p.keyJump)
  17. jjNxt(false, true);
  18.  
  19. if(p.keySelect)
  20. jjNxt(false, true);
  21. }
  22.  
  23.  
  24. bool onDrawHealth(jjPLAYER@ p, jjCANVAS@ canvas) {return true;}
  25.  
  26. bool onDrawLives(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  27. bool onDrawScore(jjPLAYER@ p, jjCANVAS@ canvas)  {return true;}
  28. bool onDrawAmmo(jjPLAYER@ p, jjCANVAS@ canvas)   {return true;}
  29.  
  30. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  31. class Sign {
  32.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  33.         private string text;
  34.         private uint widthOfText;
  35.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  36.         Sign(int xTile, int yTile, const string &in t) {
  37.                 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
  38.                 yPos = yTile * 32; //
  39.                 text = t;
  40.                 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.
  41.                 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.
  42.                 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.
  43.         }
  44.         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.
  45.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  46.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  47.         }
  48. }
  49. const array<Sign> Signs = {
  50.         Sign(3, 13, "EVASMINE: Hey! What's the meaning of this disturbance?\nTHIEF: We, the 40 Thieves have conquered the city. You're under our custody!\nEVASMINE: That can't be! Where's my father?\nTHIEF: The Sultan's dead.\nEVASMINE: Oh no!\n\nHit ||||||||SPACE |or ||||||||JUMP |to visit ||||||||ARABIUS."),
  51.  
  52. };
  53.  
  54. void onDrawLayer2(jjPLAYER@, jjCANVAS@ layer) {
  55.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  56.         for (uint signID = 0; signID < Signs.length; ++signID)
  57.                 Signs[signID].draw(layer, textIntensity);
  58.  
  59. }
  60.  
  61. void onLevelLoad() {
  62.         jjLevelName = ("");
  63.  
  64.         jjObjectPresets[OBJECT::FENCER].behavior = Thief;
  65.         jjObjectPresets[OBJECT::FENCER].scriptedCollisions = true;
  66. }
  67.  
  68.  
  69. void Thief(jjOBJ@ obj) {
  70.  
  71.                 obj.behave(BEHAVIOR::FENCER, false);
  72.                         obj.determineCurAnim(ANIM::FENCER, 0);
  73.                         obj.determineCurFrame();
  74.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 48);
  75.  
  76.  
  77.         }
  78.  
  79.