Downloads containing xlmscar.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: ScarwoodFeatured Download Jelly Jam Capture the flag 8.4 Download file

File preview

  1. #include "MLLE-Include-1.4.asc"
  2. const bool MLLESetupSuccessful = MLLE::Setup();
  3. #pragma require "xlmscar.j2l"
  4. #pragma require "ICMediv2o1.j2t"
  5. #pragma require "TornadoGun.j2a"
  6.  
  7. bool gameIsActive() {
  8.         return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
  9. }
  10.  
  11. void onLevelLoad() {
  12.  
  13.         jjDelayGeneratedCrateOrigins = true;
  14.  
  15.  
  16.         jjTexturedBGFadePositionY = 0.85;
  17.         jjUseLayer8Speeds = true;
  18.         jjTexturedBGTexture = TEXTURE::MEDIVO;
  19.  
  20.         jjAnimSets[ANIM::CUSTOM[26]].load(0, "TornadoGun.j2a");
  21.         jjAnimations[jjAnimSets[ANIM::AMMO] + 57] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 3];
  22.         jjAnimations[jjAnimSets[ANIM::AMMO] + 56] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 2];
  23.  
  24.         jjObjectPresets[OBJECT::TOASTERBULLET].behavior = TornadoGun();
  25.         jjObjectPresets[OBJECT::TOASTERBULLET].special = jjObjectPresets[OBJECT::TOASTERBULLET].determineCurAnim(ANIM::CUSTOM[26], 0);
  26.         jjObjectPresets[OBJECT::TOASTERBULLET].xSpeed = 4;
  27.         jjObjectPresets[OBJECT::TOASTERBULLET].counterEnd = 110;
  28.         jjObjectPresets[OBJECT::TOASTERBULLET].var[6] = 0;
  29.         jjObjectPresets[OBJECT::TOASTERBULLET].freeze = 0;
  30.         jjObjectPresets[OBJECT::TOASTERBULLET].eventID = OBJECT::FIREBALLBULLET;
  31.         jjObjectPresets[OBJECT::TOASTERBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
  32.         jjObjectPresets[OBJECT::TOASTERBULLET].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
  33.         jjObjectPresets[OBJECT::TOASTERBULLET].lightType = LIGHT::POINT;
  34.        
  35.          jjObjectPresets[OBJECT::TOASTERBULLETPU].behavior = TornadoGunPU();
  36.         jjObjectPresets[OBJECT::TOASTERBULLETPU].special = jjObjectPresets[OBJECT::TOASTERBULLETPU].determineCurAnim(ANIM::CUSTOM[26], 1);
  37.         jjObjectPresets[OBJECT::TOASTERBULLETPU].xSpeed = 6;
  38.         jjObjectPresets[OBJECT::TOASTERBULLETPU].counterEnd = 120;
  39.         jjObjectPresets[OBJECT::TOASTERBULLETPU].var[6] = 8;
  40.         jjObjectPresets[OBJECT::TOASTERBULLETPU].freeze = 0;
  41.         jjObjectPresets[OBJECT::TOASTERBULLETPU].eventID = OBJECT::FIREBALLBULLET;
  42.         jjObjectPresets[OBJECT::TOASTERBULLETPU].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
  43.         jjObjectPresets[OBJECT::TOASTERBULLETPU].lightType = LIGHT::POINT2;
  44.        
  45.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::CUSTOM[26], 4);
  46.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurFrame();
  47.        
  48.         jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurAnim(ANIM::CUSTOM[26], 5);
  49.         jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurFrame();
  50.  
  51.  
  52.          jjWeapons[WEAPON::TOASTER].defaultSample = false;
  53.         jjWeapons[WEAPON::TOASTER].replacedByBubbles = false;
  54.         jjWeapons[WEAPON::TOASTER].spread = SPREAD::NORMAL;
  55.         jjWeapons[WEAPON::TOASTER].style = WEAPON::NORMAL;
  56.         jjWeapons[WEAPON::TOASTER].multiplier = 1;
  57.        
  58.   jjPIXELMAP rain(32,32);
  59.   for (uint x = 0; x < rain.width; ++x) {
  60.     for (uint y = 0; y < rain.height; ++y) {
  61.       if (x == 16) { //draw in the middle of the tile, xPixel 16
  62.         if (y <= 24) rain[x,y] = 77; //if at yPixel 24 or less, use color 75
  63.         else rain[x,y] = 76; //use color 74 for yPixels 25-32
  64.       } else {
  65.         rain[x,y] = 0;
  66.       }
  67.     }
  68.   }
  69.  
  70.   jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
  71.   for (uint frameID = 0; frameID < anim.frameCount; ++frameID) {
  72.     jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame + frameID];
  73.     rain.save(frame);
  74.     frame.hotSpotX = -frame.width/2;
  75.     frame.hotSpotY = -frame.height;
  76.         }
  77. }
  78. void onMain() {
  79.        
  80.   for (int i = 0; i < 1024; i++) { //loop through the global array jjParticles[1024]
  81.     jjPARTICLE@ particle = jjParticles[i];
  82.     if (particle.type == PARTICLE::RAIN) {
  83.       particle.xSpeed = 0; //make rain fall straight down
  84.       particle.ySpeed = jjLocalPlayers[0].ySpeed < 0? 10 : int(10 + jjLocalPlayers[0].ySpeed); //the rain speed accounts for differences in the player speed, and so won't appear to fall more slowly when the player is falling
  85.     }
  86.   }
  87.  
  88. for (int i = 1; i < jjObjectCount; i++) {
  89.            jjOBJ@ o = jjObjects[i];
  90.            if (o.isActive) {
  91.                if (o.behavior == BEHAVIOR::PICKUP && o.state == STATE::FLOATFALL) {
  92.                      o.state = STATE::FLOAT;
  93.                 }
  94.            }
  95.         }
  96. }
  97.  
  98. class TornadoGun : jjBEHAVIORINTERFACE {
  99.         void onBehave(jjOBJ@ obj) {
  100.                 obj.behave(BEHAVIOR::BULLET);
  101.                 jjPLAYER@ creator = jjPlayers[obj.creatorID];
  102.                 if (obj.state == STATE::FLY) {
  103.                         if (obj.counter == 1 && creator.isLocal) {
  104.                                 jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 25000);
  105.                                 jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 25000);
  106.                         }
  107.                        
  108.                         switch (obj.direction) {
  109.                                 case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  110.                                 case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  111.                         }
  112.                        
  113.                 }
  114.                 if (obj.state == STATE::EXPLODE) {
  115.                         if (obj.var[0] == 0) {
  116.                                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
  117.                                 obj.var[0] = 1;
  118.                         }
  119.                 }
  120.         }
  121. }
  122.  
  123. class TornadoGunPU : jjBEHAVIORINTERFACE {
  124.         void onBehave(jjOBJ@ obj) {
  125.                 obj.behave(BEHAVIOR::BULLET);
  126.                 jjPLAYER@ creator = jjPlayers[obj.creatorID];
  127.                 if (obj.state == STATE::FLY) {
  128.                         if (obj.counter == 1 && creator.isLocal) {
  129.                                 jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 30000);
  130.                                 jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 30000);
  131.                         }
  132.  
  133.                         switch (obj.direction) {
  134.                                 case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  135.                                 case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  136.                         }
  137.  
  138.                 }
  139.                 if (obj.state == STATE::EXPLODE) {
  140.                         if (obj.var[0] == 0) {
  141.                                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
  142.                                 obj.var[0] = 1;
  143.                         }
  144.                 }
  145.         }
  146. }