Downloads containing HH17_level02.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Holiday Hare '17Featured Download ShadowGPW Single player 8.8 Download file

File preview

  1. #include "MLLE-Include-1.4.asc"
  2. const bool MLLESetupSuccessful = MLLE::Setup();
  3. #pragma require "HH17_level02-MLLE-Data-1.j2l"
  4. #pragma require "SExmas.j2a"
  5. #pragma require "HH17_level02.j2l"
  6. #pragma require "HH17_level02-Data-1.j2l"
  7. #include "HH17Enemies.asc"
  8.  
  9. class Imitation : jjBEHAVIORINTERFACE {
  10.         private uint8 eventID;
  11.         private jjBEHAVIOR behavior;
  12.         Imitation(uint8 realEventID, uint8 fakeEventID) {
  13.                 jjOBJ@ obj = jjObjectPresets[realEventID];
  14.                 eventID = obj.eventID;
  15.                 behavior = obj.behavior;
  16.                 obj.eventID = fakeEventID;
  17.                 obj.behavior = this;
  18.         }
  19.         void onBehave(jjOBJ@ obj) override {
  20.                 if (obj.state == STATE::DEACTIVATE)
  21.                         obj.eventID = eventID;
  22.                 obj.behave(behavior);
  23.         }
  24. }
  25. class GiftBox : jjBEHAVIORINTERFACE {
  26.         void destroy(jjOBJ@ obj) {
  27.                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_WOOD1);
  28.                 {
  29.                         int id = jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos);
  30.                         if (id != 0) {
  31.                                 jjOBJ@ other = jjObjects[id];
  32.                                 other.determineCurAnim(ANIM::PICKUPS, 4);
  33.                         }
  34.                 }
  35.                 for (int i = jjRandom() & 7 | 8; i-- != 0;) {
  36.                         int id = jjAddObject(OBJECT::SHARD, obj.xPos, obj.yPos);
  37.                         if (id != 0) {
  38.                                 jjOBJ@ other = jjObjects[id];
  39.                                 other.determineCurAnim(ANIM::PICKUPS, 93 + (jjRandom() & 1));
  40.                         }
  41.                 }
  42.                 obj.yPos -= 8.f;
  43.                 for (int i = obj.var[1]; i-- != 0;) {
  44.                         int id = jjAddObject(obj.var[0], obj.xPos, obj.yPos);
  45.                         if (id != 0) {
  46.                                 jjOBJ@ other = jjObjects[id];
  47.                                 if (other.playerHandling == HANDLING::PICKUP) {
  48.                                         int angle = (jjRandom() & 255) + 128;
  49.                                         other.xSpeed = jjCos(angle) * 5.f;
  50.                                         other.ySpeed = jjSin(angle) * -3.f;
  51.                                 } else if (other.playerHandling == HANDLING::SPECIAL) {
  52.                                         other.deactivates = false;
  53.                                 }
  54.                         }
  55.                 }
  56.                 obj.clearPlatform();
  57.                 obj.delete();
  58.         }
  59.         void onBehave(jjOBJ@ obj) override {
  60.                 switch (obj.state) {
  61.                         case STATE::START:
  62.                                 {
  63.                                         uint16 x = int(obj.xOrg) >>> 5;
  64.                                         uint16 y = int(obj.yOrg) >>> 5;
  65.                                         obj.var[0] = jjParameterGet(x, y, 0, 8);
  66.                                         obj.var[1] = jjParameterGet(x, y, 8, 4);
  67.                                         obj.curAnim += jjParameterGet(x, y, 12, 2);
  68.                                         obj.determineCurFrame();
  69.                                         obj.bulletHandling = HANDLING::DESTROYBULLET;
  70.                                         obj.scriptedCollisions = true;
  71.                                 }
  72.                                 break;
  73.                         case STATE::FALL:
  74.                                 obj.var[2] = 1;
  75.                                 break;
  76.                         case STATE::FREEZE:
  77.                         case STATE::SLEEP:
  78.                                 if (obj.var[2] != 0) {
  79.                                         destroy(obj);
  80.                                         return;
  81.                                 }
  82.                 }
  83.                 obj.behave(BEHAVIOR::MONITOR);
  84.         }
  85.         bool onObjectHit(jjOBJ@, jjOBJ@, jjPLAYER@, int) {
  86.                 return true;
  87.         }
  88.         bool onIsSolid(jjOBJ@) {
  89.                 return true;
  90.         }
  91. }
  92. void onLevelLoad() {
  93.         Imitation(OBJECT::TACO, OBJECT::MILK);
  94.         uint src = jjAnimSets[ANIM::CUSTOM[255]].load(0, "SExmas.j2a");
  95.         uint dest = jjAnimSets[ANIM::PICKUPS];
  96.         for (int i = 0; i < 95; i++) {
  97.                 const jjANIMATION@ anim = jjAnimations[src + i];
  98.                 if (anim.frameCount != 0)
  99.                         jjAnimations[dest + i] = anim;
  100.         }
  101.         jjAnimSets[ANIM::BRIDGE].load(1, "SExmas.j2a");
  102.         jjAnimSets[ANIM::CUSTOM[0]].load(2, "SExmas.j2a");
  103.         jjObjectPresets[OBJECT::BOMBCRATE].behavior = GiftBox();
  104.         jjObjectPresets[OBJECT::BOMBCRATE].determineCurAnim(ANIM::CUSTOM[0], 0);
  105.  
  106.         HH17::setEnemy(OBJECT::DRAGON);
  107.  
  108. }
  109.  
  110. void onLevelReload() {
  111.         MLLE::Palette.apply();
  112.         HH17::processEnemyColors(); //ensure that enemy colors are still displaying correctly when the level reloads after death
  113. }
  114.  
  115. void onMain() {
  116.     HH17::handleEnemyProjectiles(); //this is required to handle the modifications to enemy bullets from the Monkeys and Dragons
  117. }