Downloads containing mo4a_0_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. const bool MLLESetupSuccessful = MLLE::Setup(); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5.asc" ///@MLLE-Generated
  3. #pragma require "mo4a_0_cutscene.j2l" ///@MLLE-Generated
  4.  
  5.  
  6. void onPlayer(jjPLAYER@ p) {
  7.           p.cameraFreeze(10*32, 20*32, true, true);
  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.  
  18. if(p.keyFire)
  19. jjNxt(false, true);
  20.  
  21. if(p.keyJump)
  22. jjNxt(false, true);
  23.  
  24. if(p.keySelect)
  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.         jjLevelName = ("");
  36.         jjObjectPresets[OBJECT::BIGBOX].behavior = TimeMachine;
  37.         jjObjectPresets[OBJECT::BIGBOX].determineCurAnim(ANIM::FLAG, 1);
  38.         jjObjectPresets[OBJECT::BIGBOX].putOnGround(false);
  39.         jjObjectPresets[OBJECT::BIGBOX].scriptedCollisions = true;
  40.         jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::BIGBOX].curAnim];
  41.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  42.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -90;
  43.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  44.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;
  45.  
  46.         jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
  47.         jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
  48.         jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
  49.         jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
  50.         for (uint i = 0; i < BAnim.frameCount; ++i)
  51.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotY = -85;
  52.         for (uint i = 0; i < BAnim.frameCount; ++i)
  53.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;
  54.  
  55.         jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
  56.         jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
  57.         jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
  58.         jjObjectPresets[OBJECT::INVINCIBILITY].bulletHandling = HANDLING::IGNOREBULLET;
  59.         jjObjectPresets[OBJECT::INVINCIBILITY].playerHandling = HANDLING::PLAYERBULLET;
  60.         jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];
  61.  
  62.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  63.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 12;
  64.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  65.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;
  66.  
  67. }
  68.  
  69. void Bonuseye(jjOBJ@ obj){
  70.         obj.direction = -1;
  71.         obj.behave(BEHAVIOR::PICKUP, false);
  72.         obj.draw();
  73. }
  74. void Bonus(jjOBJ@ obj){
  75.         obj.putOnGround();
  76.         obj.direction = -1;
  77.         obj.behave(BEHAVIOR::PICKUP, false);
  78.         obj.draw();
  79. }
  80.  
  81.  
  82.  
  83. void TimeMachine(jjOBJ@ obj){
  84.         obj.behave(BEHAVIOR::EVA, false);
  85.                         jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);
  86.  
  87. }
  88.  
  89. void onLevelReload() {
  90.         jjLocalPlayers[0].lives++;
  91. }
  92.  
  93. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  94. class Sign {
  95.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  96.         private string text;
  97.         private uint widthOfText;
  98.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  99.         Sign(int xTile, int yTile, const string &in t) {
  100.                 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
  101.                 yPos = yTile * 32; //
  102.                 text = t;
  103.                 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.
  104.                 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.
  105.                 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.
  106.         }
  107.         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.
  108.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  109.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_SCREEN, textIntensity);
  110.         }
  111. }
  112. const array<Sign> Signs = {
  113.         Sign(0, 24, "Greetings, your grace. I am Bonus, Merlin's ward. Devan has stolen four Time Freezers,\nartifacts that are used as a power source to the machine. He and his goons have conquered\nfour ancient empires from different times and hid the artifacts beneath their temples.\nYou should travel between eras to recieve the Freezers and get the machine work.\nIf you collect all four artifacts, I will send you back in time to save Princess Ela."),
  114.         Sign(0, 28, "Hit ||||||||SPACE |or ||||||||JUMP |to continue."),
  115. };
  116.  
  117. void onDrawLayer1(jjPLAYER@, jjCANVAS@ layer) {
  118.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  119.         for (uint signID = 0; signID < Signs.length; ++signID)
  120.                 Signs[signID].draw(layer, textIntensity);
  121. }