Downloads containing LapFestEx.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Lapper FestiveFeatured Download Violet CLM Tileset conversion 9.3 Download file

File preview

  1. void onLevelLoad() {
  2.         jjLayers[6].spriteMode = SPRITE::PALSHIFT;
  3.         jjLayers[6].spriteParam = 16*3;
  4.         jjLayers[6].yOffset = -75;
  5.        
  6.         jjPIXELMAP rockImage(0,0, 96,96, 5);
  7.         jjANIMFRAME@ rockFrame = jjAnimFrames[jjObjectPresets[OBJECT::ROTATINGROCK].curFrame];
  8.         rockImage.save(rockFrame);
  9.         rockFrame.hotSpotY -= 8;
  10.        
  11.         uint giftAnimID = jjAnimSets[ANIM::CUSTOM[0]].allocate(array<uint> = {3,1,1,1,1, 3,1,1,1,1, 3,1,1,1,1});
  12.         for (uint color = 0; color < 3; ++color, ++giftAnimID) {
  13.                 const uint y = (3 + color) * 32;
  14.                 for (uint state = 0; state < 3; ++state) {
  15.                         jjANIMFRAME@ boxFrame = jjAnimFrames[jjAnimations[giftAnimID] + state];
  16.                         jjPIXELMAP(state * 64 + 13, y, 48,32, 5).save(boxFrame);
  17.                         boxFrame.hotSpotX = -24;
  18.                         boxFrame.hotSpotY = 0;
  19.                 }
  20.                 for (uint shard = 0; shard < 4; ++shard) {
  21.                         jjANIMFRAME@ shardFrame = jjAnimFrames[jjAnimations[++giftAnimID]];
  22.                         jjPIXELMAP((6 + shard) * 32, y, 32,32, 5).save(shardFrame);
  23.                         shardFrame.hotSpotX = shardFrame.hotSpotY = -16;
  24.                 }
  25.         }
  26.        
  27.         jjObjectPresets[OBJECT::GUNCRATE].behavior =
  28.         jjObjectPresets[OBJECT::CARROTCRATE].behavior =
  29.         jjObjectPresets[OBJECT::ONEUPCRATE].behavior =
  30.         jjObjectPresets[OBJECT::BOMBCRATE].behavior =
  31.         jjObjectPresets[OBJECT::SPRINGCRATE].behavior =
  32.         jjObjectPresets[OBJECT::GEMCRATE].behavior =
  33.         jjObjectPresets[OBJECT::BOUNCERAMMO15].behavior =
  34.         jjObjectPresets[OBJECT::ICEAMMO15].behavior =
  35.         jjObjectPresets[OBJECT::SEEKERAMMO15].behavior =
  36.         jjObjectPresets[OBJECT::RFAMMO15].behavior =
  37.         jjObjectPresets[OBJECT::TOASTERAMMO15].behavior =
  38.                 Gift;
  39.                
  40.         jjObjectPresets[OBJECT::DESTRUCTSCENERY].behavior = Lamp;
  41.                
  42.         auto layers = jjLayerOrderGet();
  43.         jjLayerYOffset[7] = -3 * 32 + 10;
  44.         for (uint additionalLayerID = 0; additionalLayerID < 4; ++additionalLayerID) {
  45.                 jjLAYER mountains(jjLayers[7]);
  46.                 mountains.yOffset = jjLayerYOffset[7] + (additionalLayerID + 1) * (40 * 32 + 52);
  47.                 mountains.xSpeed = jjLayerXSpeed[7] * (4 - additionalLayerID) / 6;
  48.                 mountains.ySpeed -= 0.03 * (additionalLayerID + 1);
  49.                 layers.insertAt(additionalLayerID + 7, mountains);
  50.         }
  51.         jjLayerOrderSet(layers);
  52. }
  53.  
  54. void onDrawLayer8(jjPLAYER@, jjCANVAS@ canvas) {
  55.         canvas.drawRectangle(0, 8*32, 25*32, 8*32, 203, SPRITE::TRANSLUCENT);
  56. }
  57.  
  58. [SOLID]
  59. void Gift(jjOBJ@ obj) {
  60.         if (obj.state == STATE::START) {
  61.                 obj.determineCurAnim(ANIM::CUSTOM[0], (jjRandom() % 3) * 5);
  62.                 obj.frameID = 0;
  63.                 obj.determineCurFrame();
  64.                 obj.behave(BEHAVIOR::CRATE, false);
  65.         } else if (obj.state == STATE::DONE) {
  66.                 //obj.beSolid();
  67.                 obj.draw();
  68.         } else if (obj.state == STATE::ACTION) {
  69.                 obj.behave(BEHAVIOR::CRATE, false);
  70.                 if (jjGameConnection == GAME::LOCAL) {
  71.                         obj.state = STATE::DONE;
  72.                         obj.creatorType = CREATOR::OBJECT;
  73.                         obj.behavior = Gift;
  74.                         obj.playerHandling = HANDLING::SPECIALDONE;
  75.                         obj.bulletHandling = HANDLING::IGNOREBULLET;
  76.                         obj.curFrame = jjAnimations[obj.curAnim] + 2;
  77.                         obj.justHit = 0;
  78.                         obj.draw();
  79.                         uint shardID = 0;
  80.                         for (uint objectID = jjObjectCount; --objectID != 0;) {
  81.                                 jjOBJ@ shard = jjObjects[objectID];
  82.                                 if (shard.eventID == OBJECT::SHARD && shard.isActive && shard.xOrg == obj.xPos && shard.yOrg == obj.yPos)
  83.                                         shard.curAnim = obj.curAnim + 1 + (shardID++ & 3);
  84.                         }
  85.                 } else {
  86.                         obj.delete();
  87.                 }
  88.         } else {
  89.                 obj.behave(BEHAVIOR::CRATE);
  90.                 jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos - 32, obj.curFrame + 1, 1);
  91.         }
  92. }
  93.  
  94. void Lamp(jjOBJ@ obj) {
  95.         if (obj.state == STATE::START) {
  96.                 obj.behave(BEHAVIOR::DESTRUCTSCENERY, false);
  97.                 if ((jjTileGet(4, uint(obj.xOrg) >> 5, uint(obj.yOrg) >> 5) & TILE::RAWRANGE) == 361) {
  98.                         obj.lightType = LIGHT::NORMAL;
  99.                         obj.light = 11;
  100.                 }
  101.         } else {
  102.                 obj.behave(BEHAVIOR::DESTRUCTSCENERY, false);
  103.                 if (obj.state == STATE::DONE) {
  104.                         obj.lightType = LIGHT::NONE;
  105.                         obj.behavior = BEHAVIOR::DESTRUCTSCENERY;
  106.                 }
  107.         }
  108. }