Downloads containing mo4a_0.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(array<MLLEWeaponApply@> = {null, null, DefaultWeapons::Blaster(), DefaultWeapons::Blaster(), DefaultWeapons::Blaster(), null, DefaultWeapons::Blaster(), null, DefaultWeapons::Blaster()}); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  3. #pragma require "mo4a_0.j2l" ///@MLLE-Generated
  4. #include "MLLE-DefaultWeapons.asc" ///@MLLE-Generated
  5. #pragma require "MLLE-DefaultWeapons.asc" ///@MLLE-Generated
  6. #include "Jazz1Enemies v05.asc"
  7. #include "Resize v11.asc"
  8. #include "HH18savegems.asc"
  9. int MovePlatform = 0; int ElevatorUp = 0;
  10. bool keypicked = false;                
  11.  
  12. void onLevelLoad()  {
  13.         jjLevelName = ("@@@@@@@@@Throne Rooms");
  14.  
  15.         jjObjectPresets[OBJECT::SAVEPOST].behavior = CheckpointWrapper;
  16.         jjObjectPresets[OBJECT::SAVEPOST].deactivates = false;
  17.         gem::restorePlayerGems();
  18.         jjWaterLighting = WATERLIGHT::GLOBAL;
  19.         jjObjectPresets[OBJECT::AIRBOARD].behavior = Key();
  20.         jjObjectPresets[OBJECT::AIRBOARD].scriptedCollisions = true;
  21.  
  22.         jjObjectPresets[OBJECT::EXTRATIME].behavior = Key2();
  23.         jjObjectPresets[OBJECT::EXTRATIME].scriptedCollisions = true;
  24.  
  25.         jjObjectPresets[OBJECT::FREEZEENEMIES].behavior = Key3();
  26.         jjObjectPresets[OBJECT::FREEZEENEMIES].scriptedCollisions = true;
  27.  
  28.         jjObjectPresets[OBJECT::FASTFEET].behavior = Key4();
  29.         jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;
  30.  
  31.         jjObjectPresets[OBJECT::FRUITPLATFORM].scriptedCollisions = true;
  32.         jjObjectPresets[OBJECT::FRUITPLATFORM].behavior = PlatformV;
  33.  
  34.         jjObjectPresets[OBJECT::SONICPLATFORM].scriptedCollisions = true;
  35.         jjObjectPresets[OBJECT::SONICPLATFORM].behavior = Elevator;
  36.         jjObjectPresets[OBJECT::SONICPLATFORM].deactivates = false;
  37.  
  38.         Jazz1::MakeEnemy(OBJECT::BUMBEE, Jazz1::Enemies::Diamondus_BumblingBee).SetUsesJJ2StyleDeathAnimation(true);
  39.         Jazz1::MakeEnemy(OBJECT::DOGGYDOGG, Jazz1::Enemies::Holidaius_BlueDog).SetUsesJJ2StyleDeathAnimation(true);
  40.  
  41.         jjObjectPresets[OBJECT::BIGBOX].behavior = TimeMachine;
  42.         jjObjectPresets[OBJECT::BIGBOX].determineCurAnim(ANIM::FLAG, 1);
  43.         jjObjectPresets[OBJECT::BIGBOX].putOnGround(false);
  44.         jjObjectPresets[OBJECT::BIGBOX].scriptedCollisions = true;
  45.         jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::BIGBOX].curAnim];
  46.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  47.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -90;
  48.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  49.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;
  50.  
  51.         jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
  52.         jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
  53.         jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
  54.         jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
  55.         for (uint i = 0; i < BAnim.frameCount; ++i)
  56.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotY = -85;
  57.         for (uint i = 0; i < BAnim.frameCount; ++i)
  58.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;
  59.  
  60.         jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
  61.         jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
  62.         jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
  63.         jjObjectPresets[OBJECT::INVINCIBILITY].bulletHandling = HANDLING::IGNOREBULLET;
  64.         jjObjectPresets[OBJECT::INVINCIBILITY].playerHandling = HANDLING::PLAYERBULLET;
  65.         jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];
  66.  
  67.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  68.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 12;
  69.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  70.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;
  71.  
  72.         jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::GEMBARREL].curAnim];
  73.         anim.frameCount = 1;
  74.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  75.         jjPIXELMAP doorkey(0, 32*32, 1*32, 1*32, 4);
  76.         doorkey.save(frame);frame.hotSpotY = -17;
  77.  
  78. }
  79.  
  80. void Bonuseye(jjOBJ@ obj){
  81.         obj.direction = -1;
  82.         obj.behave(BEHAVIOR::PICKUP, false);
  83.         obj.draw();
  84. }
  85. void Bonus(jjOBJ@ obj){
  86.         obj.putOnGround();
  87.         obj.direction = -1;
  88.         obj.behave(BEHAVIOR::PICKUP, false);
  89.         obj.draw();
  90. }
  91.  
  92.  
  93. void TimeMachine(jjOBJ@ obj){
  94.         obj.behave(BEHAVIOR::EVA, false);
  95.                         jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);
  96.  
  97. }
  98.  
  99.  
  100. void PlatformV (jjOBJ@ obj) {
  101.  
  102.         switch (obj.state) {
  103.                 case STATE::START:
  104.                         obj.direction = obj.ySpeed = -2;
  105.                         obj.determineCurAnim(ANIM::PINKPLAT, 0);  
  106.                         obj.determineCurFrame();
  107.                         obj.playerHandling = HANDLING::SPECIAL;
  108.                         obj.state = STATE::FLY;
  109.                         obj.beSolid();
  110.                 case STATE::FLY:
  111.                         obj.beSolid();
  112.                         if(MovePlatform > jjGameTicks) {
  113.                         obj.yPos = obj.yPos + obj.ySpeed;
  114.                         obj.deactivates = true;
  115.                         if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 16 : obj.xPos - 16, obj.yPos, 1)) {
  116.                                 obj.direction = obj.ySpeed = -obj.ySpeed;
  117.                         } }
  118.                         obj.draw();
  119.  
  120.                         break;
  121.  
  122.         }
  123. }
  124.  
  125. void Elevator (jjOBJ@ obj) {
  126.  
  127.         switch (obj.state) {
  128.                 case STATE::START:
  129.                         obj.direction = obj.ySpeed = 2;
  130.                         obj.determineCurAnim(ANIM::SONICPLAT, 0);  
  131.                         obj.determineCurFrame();
  132.                         obj.playerHandling = HANDLING::SPECIAL;
  133.                         obj.state = STATE::FLY;
  134.                         obj.beSolid();
  135.                 case STATE::FLY:
  136.                         obj.beSolid();
  137.                         if(p.keyUp && ElevatorUp > jjGameTicks && p.ySpeed == 0) {
  138.                         obj.yPos = obj.yPos + obj.ySpeed;
  139.                         obj.direction = obj.ySpeed = -2;
  140.                          }
  141.                         if(p.keyDown && ElevatorUp > jjGameTicks && p.ySpeed == 0) {
  142.                         obj.yPos = obj.yPos + obj.ySpeed;
  143.                         p.buttstomp = 90;
  144.                         p.ySpeed=3;
  145.                         obj.direction = obj.ySpeed = 2;
  146.                         if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 36 : obj.xPos - 16, obj.yPos, 1)) {
  147.                                 obj.ySpeed = 0;
  148.                         }
  149.                         }
  150.                         //jjDrawTile(obj.xPos - 17, obj.yPos - 22, 167);
  151.                         obj.draw();
  152.                         break;
  153.  
  154.         }
  155. }
  156.  
  157.  
  158. class Key : jjBEHAVIORINTERFACE {
  159.  
  160.         void onBehave(jjOBJ@ obj) {
  161.         if(jjTriggers[1]==false) {
  162.                 obj.behave(BEHAVIOR::PICKUP, false);
  163.                 ++obj.counter;
  164.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  165.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
  166.         }
  167. }
  168.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  169.                 jjTriggers[1] = true;
  170.                 keypicked = true;
  171.                 control = false;
  172.                 p.cameraFreeze(22*32, 17*32, true, false);
  173.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  174.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  175.  
  176.                 return true;
  177.         }
  178. }
  179.  
  180.  
  181. class Key2 : jjBEHAVIORINTERFACE {
  182.  
  183.         void onBehave(jjOBJ@ obj) {
  184.                 if(jjTriggers[2]==true)
  185.                         {obj.delete();}
  186.                 obj.behave(BEHAVIOR::PICKUP, false);
  187.                 obj.determineCurAnim(ANIM::MENU, 5);
  188.                 ++obj.counter;
  189.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  190.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -40);
  191. }
  192.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  193.                 jjTriggers[2] = true;
  194.                 keypicked = true;
  195.                 control = false;
  196.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  197.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  198.  
  199.                 return true;
  200.         }
  201. }
  202.  
  203.  
  204.  
  205. class Key3 : jjBEHAVIORINTERFACE {
  206.  
  207.         void onBehave(jjOBJ@ obj) {
  208.                 if(jjTriggers[8]==true)
  209.                         {obj.delete();}
  210.                 obj.behave(BEHAVIOR::PICKUP, false);
  211.                 obj.determineCurAnim(ANIM::MENU, 5);
  212.                 ++obj.counter;
  213.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  214.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -40);
  215. }
  216.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  217.                 jjTriggers[8] = true;
  218.                 keypicked = true;
  219.                 control = false;
  220.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  221.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  222.                 p.cameraFreeze(138*32, 26*32, true, false);
  223.                 return true;
  224.         }
  225. }
  226.  
  227. class Key4 : jjBEHAVIORINTERFACE {
  228.  
  229.         void onBehave(jjOBJ@ obj) {
  230.                 if(jjTriggers[7]==true)
  231.                         {obj.delete();}
  232.                 obj.behave(BEHAVIOR::PICKUP, false);
  233.                 obj.determineCurAnim(ANIM::MENU, 5);
  234.                 ++obj.counter;
  235.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  236.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -40);
  237. }
  238.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  239.                 jjTriggers[7] = true;
  240.                 keypicked = true;
  241.                 control = false;
  242.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  243.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  244.                 p.cameraFreeze(212*32, 26*32, true, false);
  245.                 return true;
  246.         }
  247. }
  248.  
  249. bool startrush = false, readytorush = false, soundon = true, control = true, keytext = false, keytext2 = false;
  250.  
  251. void onPlayer(jjPLAYER@ p) {
  252.  
  253.                 if(p.idle > 100 && MovePlatform == 0)
  254.                 {p.cameraUnfreeze(true);
  255.                 control=true;}
  256.                 else if (control == false && p.idle > 30 && (p.keyLeft || p.keyRight || p.keyJump || p.keyFire))
  257.                 {p.cameraUnfreeze(true);
  258.                 control = true;}
  259.  
  260.         jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::AIRBOARD].curAnim];
  261.         anim.frameCount = 1;
  262.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  263.         jjPIXELMAP doorkey(0, 31*32, 1*32, 1*32, 4);
  264.         doorkey.save(frame);frame.hotSpotY = -17;
  265.         if(MovePlatform > 0 || control==false)
  266.                 {p.keyLeft = false;
  267.                 p.keyRight = false;
  268.                 p.keyJump = false;
  269.                 p.keyFire = false;}
  270.  
  271.                 if((p.idle > 100 || p.keyLeft || p.keyRight || p.keyJump || p.keyFire) && MovePlatform == 0)
  272.                 {p.cameraUnfreeze(true);}
  273.         p.lightType = LIGHT::NONE;
  274.         gem::trackPlayerGems(p);
  275.         gem::upgradeHealth(p);
  276.         if(p.yPos > jjWaterLevel)
  277.         {p.health = 0;}
  278.  
  279.         if(p.food == 100 && jjKey[0x52] == false && startrush == false)
  280.                 {p.showText("@@@@@@@@@@@@@@@@Press 'R' when you need to use Sugar Rush!", STRING::MEDIUM);
  281.                 p.startSugarRush(0);
  282.                 startrush = true;
  283.                 readytorush = true;}
  284.  
  285.         if(readytorush == true)
  286.                 {p.food = 100;}
  287.  
  288.         if(p.food == 100 && jjKey[0x52])
  289.                 {p.startSugarRush(1400);
  290.                 p.food = 0;
  291.                 readytorush = false;
  292.                 startrush = false;
  293.         }
  294.  
  295.  
  296.         for (int i = 1; i < jjObjectCount; i++) {
  297.                 jjOBJ@ o = jjObjects[i];
  298.                 if (o.isActive && o.eventID == OBJECT::SEEKERAMMO3 && p.ammo[WEAPON::SEEKER] < 1) {
  299.                         o.state = STATE::KILL;}
  300.         }
  301.         for (int i = 1; i < jjObjectCount; i++) {
  302.                 jjOBJ@ o = jjObjects[i];
  303.                 if (o.isActive && o.eventID == OBJECT::RFAMMO3 && p.ammo[WEAPON::RF] < 1) {
  304.                         o.state = STATE::KILL;}
  305.         }
  306.         for (int i = 1; i < jjObjectCount; i++) {
  307.                 jjOBJ@ o = jjObjects[i];
  308.                 if (o.isActive && o.eventID == OBJECT::TNTAMMO3 && p.ammo[WEAPON::TNT] < 1) {
  309.                         o.state = STATE::KILL;}
  310.         }
  311.         for (int i = 1; i < jjObjectCount; i++) {
  312.                 jjOBJ@ o = jjObjects[i];
  313.                 if (o.isActive && o.eventID == OBJECT::GUN9AMMO3 && p.ammo[WEAPON::GUN9] < 1) {
  314.                         o.state = STATE::KILL;}
  315.         }
  316.         for (int i = 1; i < jjObjectCount; i++) {
  317.                 jjOBJ@ o = jjObjects[i];
  318.                 if (o.isActive && o.eventID == OBJECT::SEEKERPOWERUP && p.ammo[WEAPON::SEEKER] < 1) {
  319.                         o.state = STATE::KILL;}
  320.         }
  321.         for (int i = 1; i < jjObjectCount; i++) {
  322.                 jjOBJ@ o = jjObjects[i];
  323.                 if (o.isActive && o.eventID == OBJECT::RFPOWERUP && p.ammo[WEAPON::RF] < 1) {
  324.                         o.state = STATE::KILL;}
  325.         }
  326.         for (int i = 1; i < jjObjectCount; i++) {
  327.                 jjOBJ@ o = jjObjects[i];
  328.                 if (o.isActive && o.eventID == OBJECT::TNTPOWERUP && p.ammo[WEAPON::TNT] < 1) {
  329.                         o.state = STATE::KILL;}
  330.         }
  331.         for (int i = 1; i < jjObjectCount; i++) {
  332.                 jjOBJ@ o = jjObjects[i];
  333.                 if (o.isActive && o.eventID == OBJECT::GUN9POWERUP && p.ammo[WEAPON::GUN9] < 1) {
  334.                         o.state = STATE::KILL;}
  335.         }
  336.         if(p.keyUp && p.xPos > 101*32 && p.yPos > 23*32 && p.yPos < 25*32 && p.xPos <105*32 && jjTriggers[3] == false) {
  337.                 p.showText("@@There you go!");
  338.                 jjTriggers[3] = true;
  339.                 p.cameraFreeze(106*32, 3*32, true, false);
  340.                 jjSample(p.xPos, p.yPos, SOUND::INTRO_MONSTER2);
  341.                 }
  342.         if(p.keyUp == true && p.xPos < 124*32 && p.xPos > 122*32 && p.yPos > 25*32) {
  343.                 p.cameraFreeze(132*32, 11*32, true, false);
  344.                 MovePlatform = jjGameTicks + 55 * 61;
  345.                 jjTriggers[5] = true;
  346.                 if(soundon==true)
  347.                 {jjSample(p.xPos, p.yPos, SOUND::INTRO_MONSTER2);}
  348.                 soundon = false;
  349.                 }
  350.         if(p.keyDown && p.xPos < 124*32 && p.xPos > 122*32 && p.yPos > 25*32) {
  351.                 jjTriggers[5] = false;
  352.                 MovePlatform = 0;
  353.                 if(soundon==false)
  354.                 {jjSample(p.xPos, p.yPos, SOUND::INTRO_MONSTER2);}
  355.                 soundon = true;
  356.                 }              
  357.  
  358. }
  359.  
  360. void onFunction0(jjPLAYER@ p) {
  361. p.cameraUnfreeze();
  362. MovePlatform = 0;
  363. }
  364.  
  365. void onFunction1(jjPLAYER@ p) {
  366. ElevatorUp = jjGameTicks + 55 * 61;
  367. }
  368.  
  369. void onFunction2(jjPLAYER@ p) {
  370. ElevatorUp = 0;
  371. }
  372.  
  373. void onFunction3(jjPLAYER@ p) {
  374. p.cameraFreeze(104*32, 2*32, true, false);
  375. }
  376.  
  377. void onFunction4(jjPLAYER@ p) {
  378.         gem::saveGemData();
  379.         jjNxt(false, true);
  380. }
  381.  
  382. void onFunction5(jjPLAYER@ p) {
  383.         p.showText("@@@@@@@@@@@@@@@@@@@@@@@Royal Gardens", STRING::MEDIUM);}
  384.  
  385. void onFunction6(jjPLAYER@ p) {
  386.         p.showText("@@@@@@@@@@@@@@@@@@@@@@@Great Balconies", STRING::MEDIUM);}
  387.  
  388. void onFunction7(jjPLAYER@ p) {
  389.         keypicked = false;
  390.         keytext = true;}
  391.  
  392. void onFunction8(jjPLAYER@ p) {
  393.         if(keypicked == false && keytext == false)
  394.         p.showText("@@Locked.");
  395.         keytext = true;}
  396.  
  397. void onFunction9(jjPLAYER@ p) {
  398.         if(keypicked == false && keytext2 == false)
  399.         p.showText("@@Locked... Again.");
  400.         keytext2 = true;}
  401.  
  402. void onMain() {
  403. gem::deleteCollectedGems();
  404. if(jjKey[9] && jjKey[0x51]) {
  405. p.morphTo(CHAR::JAZZ, false);
  406. }
  407. if(jjKey[9] && jjKey[0x57]) {
  408. p.morphTo(CHAR::SPAZ, false);
  409. }
  410. if(jjKey[9] && jjKey[0x45]) {
  411. p.morphTo(CHAR::LORI, false);
  412. }
  413. }
  414.  
  415. bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {
  416. if(keypicked == true && (jjTriggers[1]==true || jjTriggers[7]==true || jjTriggers[8]==true || jjTriggers[2]==true))
  417.     {canvas.drawSprite(20, 585, ANIM::PICKUPS, 36, jjGameTicks>>2, -1, SPRITE::NORMAL);}
  418.     return false;
  419. }
  420.  
  421. bool onDrawLives(jjPLAYER@ player, jjCANVAS@ screen) {     return true;}
  422.  
  423. void onLevelReload() {
  424.         for (uint i = 0; i < 32; ++i)
  425.                 jjTriggers[i] = SavedTriggers[i];
  426.         gem::restorePlayerGems();
  427.         jjLocalPlayers[0].lives++;
  428.         jjWaterLighting = WATERLIGHT::GLOBAL;
  429. }
  430.  
  431. array<bool> SavedTriggers(32, false);
  432. //Extendable Checkpoints by VioletCLM
  433. void CheckpointWrapper(jjOBJ@ obj) {
  434.   if (obj.state == STATE::STOP) { //don't do anything anymore
  435.     jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
  436.   } else if (obj.state == STATE::DEACTIVATE) { //due to death
  437.     obj.deactivate();
  438.   } else {
  439.     obj.behave(BEHAVIOR::CHECKPOINT);
  440.         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
  441.     if (obj.state == STATE::DONE) { //triggered by the player hitting it
  442.       obj.state = STATE::STOP;
  443.       //save the current state of some properties
  444.       for (uint i = 0; i < 32; ++i)
  445.         SavedTriggers[i] = jjTriggers[i];
  446.  
  447.       //OPTIONAL: this loop makes checkpoints reusable, so only the most recent checkpoint you touched is ever active
  448.       for (int i = jjObjectCount; --i > 0;) {
  449.         jjOBJ@ obj2 = jjObjects[i];
  450.         if (obj2.eventID == OBJECT::CHECKPOINT && i != obj.objectID && obj2.isActive) {
  451.           obj2.state = STATE::SLEEP;
  452.           obj2.var[0] = 0;
  453.         }
  454.       }
  455.     }
  456.   }
  457. }
  458.  
  459.  
  460. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  461. class Sign {
  462.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  463.         private string text;
  464.         private uint widthOfText;
  465.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  466.         Sign(int xTile, int yTile, const string &in t) {
  467.                 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
  468.                 yPos = yTile * 32; //
  469.                 text = t;
  470.                 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.
  471.                 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.
  472.                 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.
  473.         }
  474.         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.
  475.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  476.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  477.         }
  478. }
  479. const array<Sign> Signs = {
  480.         Sign(9, 16, "Good luck honey.\nBring back my daughter!"),
  481.         Sign(28, 7, "Vases might contain\nvaluable items."),
  482.         Sign(123, 2, "Merlin's ward is waiting for you\nin Royal Gardens."),
  483.         Sign(159, 26, "Since your last quest you experience some kind\nof amnesia. As a part of it you forgot how to swim..."),
  484.  
  485.  
  486. };
  487.  
  488. void onDrawLayer3(jjPLAYER@, jjCANVAS@ layer) {
  489.         if(jjKey[0x54]){
  490.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  491.         for (uint signID = 0; signID < Signs.length; ++signID)
  492.                 Signs[signID].draw(layer, textIntensity);
  493. }
  494. }
  495. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  496.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  497. }
  498.