Downloads containing mo4a_1-1.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(), WeaponVMega::Backfire::Weapon(), null, DefaultWeapons::Blaster(), null, DefaultWeapons::Blaster()}); ///@MLLE-Generated
  2. #include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
  3. #pragma require "mo4a_1-1.j2l" ///@MLLE-Generated
  4. #include "WeaponVMega5.asc" ///@MLLE-Generated
  5. #pragma require "WeaponVMega5.asc" ///@MLLE-Generated
  6. #include "MLLE-DefaultWeapons.asc" ///@MLLE-Generated
  7. #pragma require "MLLE-DefaultWeapons.asc" ///@MLLE-Generated
  8. #include "Jazz1Enemies v05.asc"
  9. #include "Resize v11.asc"
  10. #include "TrueColor v13.asc"
  11. #include "HH18savegems.asc"
  12.  
  13. bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {
  14.     canvas.drawSprite(20, 585, ANIM::PICKUPS, 84, jjGameTicks>>2, -1, SPRITE::PALSHIFT, -8);
  15.     canvas.drawString(30, 585, formatInt(player.coins%4, "1") + "/3", STRING::SMALL, STRING::NORMAL);
  16. if(keypicked == true && jjTriggers[3]==true)
  17.     {canvas.drawSprite(110, 585, ANIM::PICKUPS, 36, jjGameTicks>>2, -1, SPRITE::NORMAL);}
  18.     return false;
  19. }
  20.  
  21. bool onDrawLives(jjPLAYER@ player, jjCANVAS@ canvas) {     return true;}
  22.  
  23. void onLevelLoad()  {
  24.         gem::restorePlayerGems();
  25.         jjLevelName = ("@@@@@@@@@Central Area");
  26.         jjObjectPresets[OBJECT::SAVEPOST].behavior = CheckpointWrapper;
  27.         jjObjectPresets[OBJECT::SAVEPOST].deactivates = false;
  28.  
  29.         jjObjectPresets[OBJECT::GRASSPLATFORM].scriptedCollisions = true;
  30.         jjObjectPresets[OBJECT::GRASSPLATFORM].behavior = SpikeBump();
  31.         jjObjectPresets[OBJECT::GRASSPLATFORM].deactivates = false;
  32.  
  33.         jjObjectPresets[OBJECT::AIRBOARD].behavior = Key();
  34.         jjObjectPresets[OBJECT::AIRBOARD].scriptedCollisions = true;
  35.  
  36.         jjObjectPresets[OBJECT::FREEZEENEMIES].behavior = Key2();
  37.         jjObjectPresets[OBJECT::FREEZEENEMIES].scriptedCollisions = true;
  38.  
  39.         jjObjectPresets[OBJECT::SILVERCOIN].behavior = PlatinCoin();
  40.         jjObjectPresets[OBJECT::SILVERCOIN].scriptedCollisions = true;
  41.  
  42.         jjObjectPresets[OBJECT::MOTH].behavior = Magic;
  43.  
  44.         jjObjectPresets[OBJECT::RFAMMO15].behavior = Backfiregun();
  45.         jjObjectPresets[OBJECT::RFAMMO15].scriptedCollisions = true;
  46.         jjObjectPresets[OBJECT::RFAMMO15].playerHandling = HANDLING::SPECIAL;
  47.  
  48.         jjObjectPresets[OBJECT::TURTLESHELL].behavior = Key3();
  49.         jjObjectPresets[OBJECT::TURTLESHELL].scriptedCollisions = true;
  50.  
  51.         jjObjectPresets[OBJECT::FASTFEET].behavior = CountlessJumps();
  52.         jjObjectPresets[OBJECT::FASTFEET].scriptedCollisions = true;
  53.  
  54.         jjObjectPresets[OBJECT::RFAMMO3].deactivates = false;
  55.  
  56.         jjObjectPresets[OBJECT::EVA].behavior = TimeMachine;
  57.         jjObjectPresets[OBJECT::EVA].determineCurAnim(ANIM::FLAG, 1);
  58.         jjObjectPresets[OBJECT::EVA].putOnGround(false);
  59.         jjObjectPresets[OBJECT::EVA].scriptedCollisions = true;
  60.         jjANIMATION@ tmAnim = jjAnimations[jjObjectPresets[OBJECT::EVA].curAnim];
  61.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  62.                 jjAnimFrames[tmAnim.firstFrame + i].coldSpotY = -44;
  63.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  64.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotY = -64;
  65.         for (uint i = 0; i < tmAnim.frameCount; ++i)
  66.                 jjAnimFrames[tmAnim.firstFrame + i].hotSpotX = -54;
  67.  
  68.         jjObjectPresets[OBJECT::FLYCARROT].determineCurAnim(ANIM::PLUS_WARP, 0);
  69.         jjObjectPresets[OBJECT::FLYCARROT].behavior = Bonus;
  70.         jjObjectPresets[OBJECT::FLYCARROT].scriptedCollisions = true;
  71.         jjANIMATION@ BAnim = jjAnimations[jjObjectPresets[OBJECT::FLYCARROT].curAnim];
  72.         for (uint i = 0; i < BAnim.frameCount; ++i)
  73.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotY = -85;
  74.         for (uint i = 0; i < BAnim.frameCount; ++i)
  75.                 jjAnimFrames[BAnim.firstFrame + i].hotSpotX = 20;
  76.  
  77.         jjObjectPresets[OBJECT::INVINCIBILITY].determineCurAnim(ANIM::PLUS_WARP, 1);
  78.         jjObjectPresets[OBJECT::INVINCIBILITY].behavior = Bonuseye;
  79.         jjObjectPresets[OBJECT::INVINCIBILITY].scriptedCollisions = true;
  80.         jjObjectPresets[OBJECT::INVINCIBILITY].bulletHandling = HANDLING::IGNOREBULLET;
  81.         jjObjectPresets[OBJECT::INVINCIBILITY].playerHandling = HANDLING::PLAYERBULLET;
  82.         jjANIMATION@ BeAnim = jjAnimations[jjObjectPresets[OBJECT::INVINCIBILITY].curAnim];
  83.  
  84.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  85.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotY = 16;
  86.         for (uint i = 0; i < BeAnim.frameCount; ++i)
  87.                 jjAnimFrames[BeAnim.firstFrame + i].hotSpotX = 26;
  88.  
  89.         Jazz1::MakeEnemy(OBJECT::DRAGONFLY, Jazz1::Enemies::Jungrock_RedBuzzer).SetUsesJJ2StyleDeathAnimation(true);
  90.         Jazz1::MakeEnemy(OBJECT::LIZARD, Jazz1::Enemies::Holidaius_SnowMonkey).SetUsesJJ2StyleDeathAnimation(true);
  91.         Jazz1::MakeEnemy(OBJECT::HATTER, Jazz1::Enemies::Marbelara_Schwarzenguard).SetUsesJJ2StyleDeathAnimation(true).SetBulletFireSound(SOUND::INTRO_SHOT1).SetBulletExplosionSound(SOUND::COMMON_GUNSM1);
  92.  
  93.         jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::SPIKEBOLL3D].curAnim];
  94.         anim.frameCount = 1;
  95.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  96.         jjPIXELMAP pump(0, 0*32, 3*32, 3*32, 4);
  97.         pump.save(frame);
  98.         frame.hotSpotY = -47;
  99.         frame.hotSpotX = -47;
  100.  
  101. }
  102.  
  103. class PlatinCoin : jjBEHAVIORINTERFACE {
  104.  
  105.         void onBehave(jjOBJ@ obj) {
  106.                 if(p.coins >= 1)
  107.                 {obj.delete();}
  108.                 obj.behave(BEHAVIOR::PICKUP, false);
  109.                 ++obj.counter;
  110.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  111.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -8);
  112. }
  113.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  114.                 p.coins += 1;
  115.                 jjTriggers[2] = true;
  116.                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_COIN, 1000);
  117.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  118.                 return true;
  119.         }
  120. }
  121.  
  122. void Bonuseye(jjOBJ@ obj){
  123.         obj.direction = -1;
  124.         obj.behave(BEHAVIOR::PICKUP, false);
  125.         obj.draw();
  126. }
  127. void Bonus(jjOBJ@ obj){
  128.         obj.putOnGround();
  129.         obj.direction = -1;
  130.         obj.behave(BEHAVIOR::PICKUP, false);
  131.         obj.draw();
  132. }
  133.  
  134.  
  135. int spring = 0;
  136. int CountlessDoubleJumps = 0;
  137.  
  138. void TimeMachine(jjOBJ@ obj){
  139.         obj.behave(BEHAVIOR::EVA, false);
  140.                         jjDrawResizedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, 1, 1, SPRITE::PALSHIFT, 8);
  141.  
  142. }
  143.  
  144. void Magic(jjOBJ@ obj) {
  145.         obj.behave(BEHAVIOR::MOTH,false);
  146.         if(jjTriggers[1] == true){
  147.                 jjPARTICLE@ particle = jjAddParticle(PARTICLE::FLOWER);
  148.                 particle.xPos = obj.xPos;
  149.                 particle.yPos = obj.yPos;
  150.         }
  151. }
  152. void onFunction0(jjPLAYER@ p) {
  153.                 {jjNxt("mo4a_1-4", false, true);
  154.                 gem::saveGemData();}
  155. }
  156.  
  157. void onFunction1(jjPLAYER@ p) {
  158.         p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@Sacred Woods", STRING::MEDIUM);
  159.         jjEnabledASFunctions[1] = false;}
  160.  
  161. void onFunction2(jjPLAYER@ p) {
  162.         p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@Totem Hills", STRING::MEDIUM);
  163.         jjEnabledASFunctions[2] = false;}
  164.  
  165. void onFunction3(jjPLAYER@ p) {
  166.         p.showText("@@@@@@@@@@@@@@@@@@@@@@@@@@Temple of Sun", STRING::MEDIUM);
  167.         jjEnabledASFunctions[3] = false;}
  168.  
  169. void onFunction4(jjPLAYER@ p) {
  170.         p.cameraFreeze(163*32, 43*32, true, false);
  171.         jjEnabledASFunctions[4] = false;}
  172.  
  173. void onFunction5(jjPLAYER@ p) {
  174.         p.cameraUnfreeze();}
  175.  
  176. void onFunction6(jjPLAYER@ p) {
  177.                 p.timerStop();
  178.                 CountlessDoubleJumps = 0;
  179.                 keypicked = false;
  180. }
  181.  
  182. bool buyammo = false, startrush = false, readytorush = false, control = true;
  183.  
  184. void onPlayer(jjPLAYER@ p) {
  185.         gem::trackPlayerGems(p);
  186.         gem::upgradeHealth(p);
  187.  
  188.                 if(control==false)
  189.                 {p.keyLeft = false;
  190.                 p.keyRight = false;
  191.                 p.keyDown = false;}
  192.  
  193.                 if(p.idle > 100 && p.xPos >180*32)
  194.                 {p.cameraUnfreeze(true);
  195.                 control=true;}
  196.                 else if ((p.idle > 5 && (p.keyLeft || p.keyRight || p.keyJump || p.keyFire)) || (p.curAnim - jjAnimSets[p.setID].firstAnim == RABBIT::LEDGEWIGGLE))
  197.                 {p.cameraUnfreeze(true);
  198.                 control = true;
  199.                 spike = false;}
  200.  
  201.  
  202.         if(p.food == 100 && jjKey[0x52] == false && startrush == false)
  203.                 {p.showText("@@@@@@@@@@@@@@@@||||||||Press 'R' when you need to use Sugar Rush!", STRING::MEDIUM);
  204.                 p.startSugarRush(0);
  205.                 startrush = true;
  206.                 readytorush = true;}
  207.  
  208.         if(readytorush == true)
  209.                 {p.food = 100;}
  210.  
  211.         if(p.food == 100 && jjKey[0x52])
  212.                 {p.startSugarRush(1400);
  213.                 p.food = 0;
  214.                 readytorush = false;
  215.                 startrush = false;
  216.         }
  217.  
  218.         for (int i = 1; i < jjObjectCount; i++) {
  219.         jjOBJ@ o = jjObjects[i];
  220.                 if (o.isActive && o.eventID == OBJECT::SILVERCOIN && p.coins >= 1) {
  221.                 o.state = STATE::KILL;
  222.                 }
  223.  
  224.         }
  225.  
  226.         if(p.ammo[WEAPON::RF] < 1 && p.xPos>162*32 && p.xPos<166*32 && p.yPos<52*32 && p.yPos>49*32 && jjKey[0x50] && p.gems[GEM::RED]<50 && buyammo == false)
  227.                 {p.testForGems(50, GEM::RED);}
  228.         if(p.ammo[WEAPON::RF] < 1 && p.xPos>162*32 && p.xPos<166*32 && p.yPos<52*32 && p.yPos>49*32 && jjKey[0x50] && p.gems[GEM::RED]>=50 && buyammo == false)
  229.                 {p.testForGems(50, GEM::RED);
  230.         jjTriggers[0]=true;
  231.         buyammo = true;}
  232.         if(p.ammo[WEAPON::RF] >= 1 && p.xPos>162*32 && p.xPos<166*32 && p.yPos<52*32 && p.yPos>49*32 && jjKey[0x50] && buyammo == false)
  233.                 {p.showText("@@You already have the weapon.");}
  234.  
  235.         if(p.xPos<2*32 && p.coins < 1 && p.yPos > 46*32)
  236.                 {p.testForCoins(1);}
  237.         if(p.xPos<2*32 && p.coins == 1 && p.yPos > 46*32)
  238.                 {jjNxt("mo4a_1-2_save", false, true);
  239.                 gem::saveGemData();}
  240.         if(p.xPos>89*32 && p.xPos<92*32 && p.yPos<2*32 && p.coins < 3)
  241.                 {p.testForCoins(3);}
  242.         if(p.xPos>89*32 && p.xPos<92*32 && p.yPos<2*32 && p.coins >= 3)
  243.                 {jjTriggers[1] = true;}
  244.  
  245.         if(spring >= jjGameTicks)
  246.                 {p.ySpeed = -10;}
  247.         p.lightType = LIGHT::NONE;
  248.  
  249.         if (CountlessDoubleJumps > jjGameTicks && p.keyJump) {
  250.                 p.doubleJumpCount = 0;}
  251.         if (p.health == 0){
  252.                 CountlessDoubleJumps  = 0;
  253. }
  254. }
  255.  
  256. class Backfiregun : jjBEHAVIORINTERFACE {
  257.  
  258.         void onBehave(jjOBJ@ obj) {
  259.                 if(p.ammo[WEAPON::RF] > 1)
  260.                 {obj.delete();}
  261.                 obj.behave(BEHAVIOR::MONITOR); 
  262.         }
  263.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
  264.                 if(bullet !is null && play !is null)
  265.                         {obj.behave(BEHAVIOR::EXPLOSION2);
  266.                         jjAddObject(OBJECT::RFAMMO3, 163*32, 42*32);
  267.                         jjAddObject(OBJECT::RFAMMO3, 162*32, 42*32);                   
  268.                         jjAddObject(OBJECT::RFAMMO3, 163*32, 43*32);
  269.                         jjAddObject(OBJECT::RFAMMO3, 162*32, 43*32);
  270.                         jjAddObject(OBJECT::RFAMMO3, 188*32, 49*32);
  271.                         jjAddObject(OBJECT::RFAMMO3, 187*32, 50*32);
  272.                         jjAddObject(OBJECT::RFAMMO3, 188*32, 51*32);
  273.                         jjAddObject(OBJECT::RFAMMO3, 187*32, 52*32);
  274.                         jjAddObject(OBJECT::RFAMMO3, 188*32, 53*32);
  275.                         jjSample(p.xPos, p.yPos, SOUND::COMMON_HARP1, 1000);}
  276.                 return true;
  277.         }
  278.        
  279. }
  280.  
  281. bool spike = false;
  282. class SpikeBump : jjBEHAVIORINTERFACE {
  283.  
  284. void onBehave(jjOBJ@ obj) {
  285.  
  286.         switch (obj.state) {
  287.                 case STATE::START:
  288.                         obj.determineCurFrame();
  289.                         obj.state = STATE::FLY;
  290.  
  291.                 case STATE::FLY:
  292.                         obj.playerHandling = HANDLING::SPECIAL;
  293.                         obj.deactivates = false;
  294.                         if (jjMaskedVLine(obj.xSpeed > 0 ? obj.xPos + 16 : obj.xPos - 16, obj.yPos, 1)) {
  295.                                 obj.direction = obj.xSpeed = -obj.xSpeed;
  296.                         }
  297.                        
  298.                         if(obj.xPos > p.xPos + 64 || obj.xPos < p.xPos - 64 || obj.yPos > p.yPos + 64 || obj.yPos < p.yPos - 64)
  299.                         {obj.determineCurAnim(ANIM::BOLLPLAT, 0);
  300.                         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -8);
  301.                         obj.determineCurFrame();}
  302.                         else {jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -24);}
  303.                         break;
  304.  
  305.                
  306.         }
  307. }
  308.  
  309.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ play, int force) {
  310.                 if(bullet is null && play !is null && (force == -1 || force == 1))
  311.                         {spring = jjGameTicks + 1*61;
  312.                         obj.determineCurAnim(ANIM::BOLLPLAT, 0);
  313.                         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, -24);
  314.                         obj.determineCurFrame();
  315.                         p.buttstomp = 121;
  316.                         jjSample(obj.xPos, obj.yPos, SOUND::PINBALL_BELL, 1000);}
  317.                 if(force == 0 && spring < jjGameTicks)
  318.                         {play.hurt();
  319.                         obj.determineCurAnim(ANIM::SPIKEBOLL, 0);  
  320.                         obj.determineCurFrame();
  321.                         if(spike == false)
  322.                         {jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 1000);}
  323.                         spike = true;}
  324.                 return true;
  325.                 }
  326.  
  327. }
  328.  
  329.  
  330. void onMain() {
  331. gem::deleteCollectedGems();
  332. if(jjKey[9] && jjKey[0x51]) {
  333. p.morphTo(CHAR::JAZZ, false);
  334. }
  335. if(jjKey[9] && jjKey[0x57]) {
  336. p.morphTo(CHAR::SPAZ, false);
  337. }
  338. if(jjKey[9] && jjKey[0x45]) {
  339. p.morphTo(CHAR::LORI, false);
  340. }
  341.         jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::ORANGE].curAnim];
  342.         anim.frameCount = 1;
  343.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  344.         jjPIXELMAP pump(0, 6*32, 1*32, 1*32, 4);
  345.         pump.save(frame);
  346. }
  347.  
  348.  
  349. class CountlessJumps : jjBEHAVIORINTERFACE {
  350.         void onBehave(jjOBJ@ obj) {
  351.  
  352. obj.behave(BEHAVIOR::PICKUP, false);
  353. obj.determineCurAnim(ANIM::PICKUPS, 33);
  354. ++obj.counter;
  355.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  356.  
  357.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 16);
  358.  
  359. }
  360.  
  361.         bool onObjectHit(jjOBJ@ obj, jjOBJ@, jjPLAYER@ play, int force) {
  362.                 play.timerStart(600);
  363.                 p.morphTo(CHAR::SPAZ);
  364.                 CountlessDoubleJumps = jjGameTicks + 10 * 61;
  365.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  366.                 obj.frameID = 0;
  367.                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PICKUP1, 6000);
  368.  
  369.                 return true;
  370.         }
  371.  
  372. }
  373.  
  374. bool keypicked = false;
  375.  
  376. class Key : jjBEHAVIORINTERFACE {
  377.  
  378.         void onBehave(jjOBJ@ obj) {
  379.                 if(jjTriggers[3]==true)
  380.                 {obj.delete();}
  381.                 obj.behave(BEHAVIOR::PICKUP, false);
  382.         jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::AIRBOARD].curAnim];
  383.         anim.frameCount = 1;
  384.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  385.         jjPIXELMAP pump(0, 4*32, 1*32, 1*32, 4);
  386.         frame.hotSpotY = -frame.width/2;
  387.         pump.save(frame);
  388.                 ++obj.counter;
  389.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  390.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
  391. }
  392.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  393.                 p.cameraFreeze(211*32, 48*32, true, false);
  394.                 jjTriggers[3] = true;
  395.                 keypicked = true;
  396.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  397.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  398.  
  399.                 return true;
  400.         }
  401. }
  402.  
  403.  
  404. class Key2 : jjBEHAVIORINTERFACE {
  405.  
  406.         void onBehave(jjOBJ@ obj) {
  407.                 obj.behave(BEHAVIOR::PICKUP, false);
  408. jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::FREEZEENEMIES].curAnim];
  409.         anim.frameCount = 1;
  410.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  411.         jjPIXELMAP pump(0, 3*32, 1*32, 1*32, 4);
  412.         pump.save(frame);
  413.                 ++obj.counter;
  414.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  415.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
  416. }
  417.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  418.                 jjTriggers[8] = true;
  419.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  420.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  421.  
  422.                 return true;
  423.         }
  424. }
  425.  
  426.  
  427.  
  428. class Key3 : jjBEHAVIORINTERFACE {
  429.  
  430.         void onBehave(jjOBJ@ obj) {
  431.                 obj.behave(BEHAVIOR::PICKUP, false);
  432.  
  433. jjANIMATION@ anim = jjAnimations[jjObjectPresets[OBJECT::TURTLESHELL].curAnim];
  434.         anim.frameCount = 1;
  435.         jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame];
  436.         jjPIXELMAP pump(0, 5*32, 1*32, 1*32, 4);
  437.         pump.save(frame);
  438.                 ++obj.counter;
  439.                 obj.yPos = jjSin(obj.counter*15 + 5)*4 + obj.yOrg;
  440.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::NORMAL);
  441. }
  442.         bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
  443.                 jjTriggers[15] = true;
  444.                 obj.behavior = BEHAVIOR::EXPLOSION2;
  445.                 jjSample(obj.xPos, obj.yPos, SOUND::MENUSOUNDS_TYPEENTER, 1000);
  446.  
  447.                 return true;
  448.         }
  449. }
  450. void onLevelReload() {
  451.         for (uint i = 0; i < 32; ++i)
  452.                 jjTriggers[i] = SavedTriggers[i];
  453.         gem::restorePlayerGems();
  454.         jjLocalPlayers[0].lives++;
  455.         buyammo == false;
  456.         jjTriggers[0] = false;
  457.         jjWaterLighting = WATERLIGHT::GLOBAL;
  458. }
  459.  
  460. array<bool> SavedTriggers(32, false);
  461. //Extendable Checkpoints by VioletCLM
  462. void CheckpointWrapper(jjOBJ@ obj) {
  463.   if (obj.state == STATE::STOP) { //don't do anything anymore
  464.     jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
  465.   } else if (obj.state == STATE::DEACTIVATE) { //due to death
  466.     obj.deactivate();
  467.   } else {
  468.     obj.behave(BEHAVIOR::CHECKPOINT);
  469.         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 8);
  470.     if (obj.state == STATE::DONE) { //triggered by the player hitting it
  471.       obj.state = STATE::STOP;
  472.       //save the current state of some properties
  473.       for (uint i = 0; i < 32; ++i)
  474.         SavedTriggers[i] = jjTriggers[i];
  475.  
  476.       //OPTIONAL: this loop makes checkpoints reusable, so only the most recent checkpoint you touched is ever active
  477.       for (int i = jjObjectCount; --i > 0;) {
  478.         jjOBJ@ obj2 = jjObjects[i];
  479.         if (obj2.eventID == OBJECT::CHECKPOINT && i != obj.objectID && obj2.isActive) {
  480.           obj2.state = STATE::SLEEP;
  481.           obj2.var[0] = 0;
  482.         }
  483.       }
  484.     }
  485.   }
  486. }
  487.  
  488. jjTEXTAPPEARANCE SignTextAppearance = STRING::NORMAL;
  489. class Sign {
  490.         private int xPos, yPos; //These pixel-based positions will be generated from tile-based positions in the constructor by multiplying by 32
  491.         private string text;
  492.         private uint widthOfText;
  493.         Sign(){} //AngelScript requires any class that appears in any array to have an explicit default constructor, even if it's never called
  494.         Sign(int xTile, int yTile, const string &in t) {
  495.                 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
  496.                 yPos = yTile * 32; //
  497.                 text = t;
  498.                 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.
  499.                 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.
  500.                 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.
  501.         }
  502.         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.
  503.                 layer.drawRectangle(xPos, yPos - 16, widthOfText + 8, 55, 0, SPRITE::TRANSLUCENT);
  504.                 layer.drawString(xPos, yPos, text, STRING::SMALL, SignTextAppearance, 0, SPRITE::BLEND_HARDLIGHT, textIntensity);
  505.         }
  506. }
  507. const array<Sign> Signs = {
  508.         Sign(255, 15, "To access the artifact's location, find\n3 tokens, scattered around the empire."),
  509.         Sign(237, 25, "Tuf Goons have captured us, invaded our\nsacred temples. Please help us!"),
  510.         Sign(217, 25, "Turtles destroyed our totems.\nWrath of the gods is coming!"),
  511.         Sign(164, 61, "What you are looking for is\nbeneath the Temple of Sun."),
  512.         Sign(162, 38, "Try not to run out of your special ammo.\nOr you'll have to buy it again."),
  513.         Sign(18, 61, "It is rumoured that a Frog Spirit was wandering\naround the Sacred Woods to prtoect our women from turtles."),
  514.         Sign(166, 48, "Press P if you'd like to\nbuy Backfire Gun for 50 Gems."),
  515.         Sign(178, 61, "Stomp or kick the ball.\nBut be careful."),
  516. };
  517.  
  518. void onDrawLayer3(jjPLAYER@, jjCANVAS@ layer) {
  519.         if(jjKey[0x54]){
  520.         const uint8 textIntensity = 200 + int(jjSin(jjGameTicks * 16) * 50);
  521.         for (uint signID = 0; signID < Signs.length; ++signID)
  522.                 Signs[signID].draw(layer, textIntensity);
  523. }
  524. }
  525. bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
  526.         return MLLE::WeaponHook.drawAmmo(player, canvas);
  527. }
  528.