Downloads containing tornadogun.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: Arcane WeaponsFeatured Download PurpleJazz Mutator 10 Download file

File preview

  1. #pragma name "Tornado Gun"
  2. #pragma require "TornadoGun.j2a"
  3.  
  4. bool gameIsActive() {
  5.         return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
  6. }
  7.  
  8. void onLevelLoad() {
  9.         jjAnimSets[ANIM::CUSTOM[26]].load(0, "TornadoGun.j2a");
  10.         jjAnimations[jjAnimSets[ANIM::AMMO] + 57] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 3];
  11.         jjAnimations[jjAnimSets[ANIM::AMMO] + 56] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 2];
  12.        
  13.         jjObjectPresets[OBJECT::TOASTERBULLET].behavior = TornadoGun();
  14.         jjObjectPresets[OBJECT::TOASTERBULLET].special = jjObjectPresets[OBJECT::TOASTERBULLET].determineCurAnim(ANIM::CUSTOM[26], 0);
  15.         jjObjectPresets[OBJECT::TOASTERBULLET].xSpeed = 4;
  16.         jjObjectPresets[OBJECT::TOASTERBULLET].counterEnd = 110;
  17.         jjObjectPresets[OBJECT::TOASTERBULLET].var[6] = 0;
  18.         jjObjectPresets[OBJECT::TOASTERBULLET].freeze = 0;
  19.         jjObjectPresets[OBJECT::TOASTERBULLET].eventID = OBJECT::FIREBALLBULLET;
  20.         jjObjectPresets[OBJECT::TOASTERBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
  21.         jjObjectPresets[OBJECT::TOASTERBULLET].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
  22.         jjObjectPresets[OBJECT::TOASTERBULLET].lightType = LIGHT::POINT;
  23.        
  24.         jjObjectPresets[OBJECT::TOASTERBULLETPU].behavior = TornadoGunPU();
  25.         jjObjectPresets[OBJECT::TOASTERBULLETPU].special = jjObjectPresets[OBJECT::TOASTERBULLETPU].determineCurAnim(ANIM::CUSTOM[26], 1);
  26.         jjObjectPresets[OBJECT::TOASTERBULLETPU].xSpeed = 6;
  27.         jjObjectPresets[OBJECT::TOASTERBULLETPU].counterEnd = 120;
  28.         jjObjectPresets[OBJECT::TOASTERBULLETPU].var[6] = 8;
  29.         jjObjectPresets[OBJECT::TOASTERBULLETPU].freeze = 0;
  30.         jjObjectPresets[OBJECT::TOASTERBULLETPU].eventID = OBJECT::FIREBALLBULLET;
  31.         jjObjectPresets[OBJECT::TOASTERBULLETPU].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
  32.         jjObjectPresets[OBJECT::TOASTERBULLETPU].lightType = LIGHT::POINT2;
  33.        
  34.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::CUSTOM[26], 4);
  35.         jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurFrame();
  36.        
  37.         jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurAnim(ANIM::CUSTOM[26], 5);
  38.         jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurFrame();
  39.  
  40.         jjWeapons[WEAPON::TOASTER].defaultSample = false;
  41.         jjWeapons[WEAPON::TOASTER].replacedByBubbles = false;
  42.         jjWeapons[WEAPON::TOASTER].spread = SPREAD::NORMAL;
  43.         jjWeapons[WEAPON::TOASTER].style = WEAPON::NORMAL;
  44.         jjWeapons[WEAPON::TOASTER].multiplier = 1;
  45. }
  46.  
  47. class TornadoGun : jjBEHAVIORINTERFACE {
  48.         void onBehave(jjOBJ@ obj) {
  49.                 obj.behave(BEHAVIOR::BULLET);
  50.                 jjPLAYER@ creator = jjPlayers[obj.creatorID];
  51.                 if (obj.state == STATE::FLY) {
  52.                         if (obj.counter == 1 && creator.isLocal) {
  53.                                 jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 25000);
  54.                                 jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 25000);
  55.                         }
  56.                        
  57.                         switch (obj.direction) {
  58.                                 case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  59.                                 case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  60.                         }
  61.                        
  62.                         float pdx = jjLocalPlayers[0].xPos - obj.xPos, pdy = jjLocalPlayers[0].yPos - obj.yPos;
  63.                         if ((pdx * pdx + pdy * pdy < 64 * 64) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
  64.                                 jjLocalPlayers[0].ySpeed -= 2.5;
  65.                                 jjLocalPlayers[0].xSpeed += 2.5 * obj.direction;
  66.                         }
  67.                 }
  68.                 if (obj.state == STATE::EXPLODE) {
  69.                         if (obj.var[0] == 0) {
  70.                                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
  71.                                 obj.var[0] = 1;
  72.                         }
  73.                 }
  74.         }
  75. }
  76.  
  77. class TornadoGunPU : jjBEHAVIORINTERFACE {
  78.         void onBehave(jjOBJ@ obj) {
  79.                 obj.behave(BEHAVIOR::BULLET);
  80.                 jjPLAYER@ creator = jjPlayers[obj.creatorID];
  81.                 if (obj.state == STATE::FLY) {
  82.                         if (obj.counter == 1 && creator.isLocal) {
  83.                                 jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 30000);
  84.                                 jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 30000);
  85.                         }
  86.  
  87.                         switch (obj.direction) {
  88.                                 case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  89.                                 case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
  90.                         }
  91.                        
  92.                         float pdx = jjLocalPlayers[0].xPos - obj.xPos, pdy = jjLocalPlayers[0].yPos - obj.yPos;
  93.                         if ((pdx * pdx + pdy * pdy < 96 * 96) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
  94.                                 jjLocalPlayers[0].ySpeed -= 5;
  95.                                 jjLocalPlayers[0].xSpeed += 5 * obj.direction;
  96.                         }
  97.                 }
  98.                 if (obj.state == STATE::EXPLODE) {
  99.                         if (obj.var[0] == 0) {
  100.                                 jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
  101.                                 obj.var[0] = 1;
  102.                         }
  103.                 }
  104.         }
  105. }
  106.