Downloads containing ab21ctf02.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 21 Levels Jazz2Online Multiple N/A Download file

File preview

#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "ab21ctf02.j2l"
#pragma require "ICMediv2o1.j2t"
#pragma require "TornadoGun.j2a"

bool gameIsActive() {
        return jjGameState == GAME::STARTED || jjGameState == GAME::OVERTIME;
}

void onLevelLoad() {

	jjDelayGeneratedCrateOrigins = true;


	jjTexturedBGFadePositionY = 0.85;
	jjUseLayer8Speeds = true;
	jjTexturedBGTexture = TEXTURE::MEDIVO;

	jjAnimSets[ANIM::CUSTOM[26]].load(0, "TornadoGun.j2a");
        jjAnimations[jjAnimSets[ANIM::AMMO] + 57] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 3];
        jjAnimations[jjAnimSets[ANIM::AMMO] + 56] = jjAnimations[jjAnimSets[ANIM::CUSTOM[26]] + 2];

	jjObjectPresets[OBJECT::TOASTERBULLET].behavior = TornadoGun();
        jjObjectPresets[OBJECT::TOASTERBULLET].special = jjObjectPresets[OBJECT::TOASTERBULLET].determineCurAnim(ANIM::CUSTOM[26], 0);
        jjObjectPresets[OBJECT::TOASTERBULLET].xSpeed = 4;
        jjObjectPresets[OBJECT::TOASTERBULLET].counterEnd = 110;
        jjObjectPresets[OBJECT::TOASTERBULLET].var[6] = 0;
        jjObjectPresets[OBJECT::TOASTERBULLET].freeze = 0;
        jjObjectPresets[OBJECT::TOASTERBULLET].eventID = OBJECT::FIREBALLBULLET;
        jjObjectPresets[OBJECT::TOASTERBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLET].lightType;
        jjObjectPresets[OBJECT::TOASTERBULLET].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
        jjObjectPresets[OBJECT::TOASTERBULLET].lightType = LIGHT::POINT;
	
	 jjObjectPresets[OBJECT::TOASTERBULLETPU].behavior = TornadoGunPU();
        jjObjectPresets[OBJECT::TOASTERBULLETPU].special = jjObjectPresets[OBJECT::TOASTERBULLETPU].determineCurAnim(ANIM::CUSTOM[26], 1);
        jjObjectPresets[OBJECT::TOASTERBULLETPU].xSpeed = 6;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].counterEnd = 120;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].var[6] = 8;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].freeze = 0;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].eventID = OBJECT::FIREBALLBULLET;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].killAnim = jjObjectPresets[OBJECT::ICEBULLET].killAnim;
        jjObjectPresets[OBJECT::TOASTERBULLETPU].lightType = LIGHT::POINT2;
	
	jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurAnim(ANIM::CUSTOM[26], 4);
        jjObjectPresets[OBJECT::TOASTERPOWERUP].determineCurFrame();
       
        jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurAnim(ANIM::CUSTOM[26], 5);
        jjObjectPresets[OBJECT::TOASTERAMMO15].determineCurFrame();
 

	 jjWeapons[WEAPON::TOASTER].defaultSample = false;
        jjWeapons[WEAPON::TOASTER].replacedByBubbles = false;
        jjWeapons[WEAPON::TOASTER].spread = SPREAD::NORMAL;
        jjWeapons[WEAPON::TOASTER].style = WEAPON::NORMAL;
        jjWeapons[WEAPON::TOASTER].multiplier = 1;
	
  jjPIXELMAP rain(32,32);
  for (uint x = 0; x < rain.width; ++x) {
    for (uint y = 0; y < rain.height; ++y) {
      if (x == 16) { //draw in the middle of the tile, xPixel 16
        if (y <= 24) rain[x,y] = 77; //if at yPixel 24 or less, use color 75
        else rain[x,y] = 76; //use color 74 for yPixels 25-32
      } else {
        rain[x,y] = 0;
      }
    }
  }

  jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::COMMON].firstAnim + 2];
  for (uint frameID = 0; frameID < anim.frameCount; ++frameID) {
    jjANIMFRAME@ frame = jjAnimFrames[anim.firstFrame + frameID];
    rain.save(frame);
    frame.hotSpotX = -frame.width/2;
    frame.hotSpotY = -frame.height;
  	}
} 
void onMain() {
	
  for (int i = 0; i < 1024; i++) { //loop through the global array jjParticles[1024]
    jjPARTICLE@ particle = jjParticles[i];
    if (particle.type == PARTICLE::RAIN) {
      particle.xSpeed = 0; //make rain fall straight down
      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
    }
  }

for (int i = 1; i < jjObjectCount; i++) { 
	   jjOBJ@ o = jjObjects[i];
	   if (o.isActive) {
	       if (o.behavior == BEHAVIOR::PICKUP && o.state == STATE::FLOATFALL) {
		     o.state = STATE::FLOAT;
	        }
	   }
	}
}

class TornadoGun : jjBEHAVIORINTERFACE {
        void onBehave(jjOBJ@ obj) {
                obj.behave(BEHAVIOR::BULLET);
                jjPLAYER@ creator = jjPlayers[obj.creatorID];
                if (obj.state == STATE::FLY) {
                        if (obj.counter == 1 && creator.isLocal) {
                                jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 25000);
                                jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 25000);
                        }
                       
                        switch (obj.direction) {
                                case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
                                case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
                        }
                       
                }
                if (obj.state == STATE::EXPLODE) {
                        if (obj.var[0] == 0) {
                                jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
                                obj.var[0] = 1;
                        }
                }
        }
}
 
class TornadoGunPU : jjBEHAVIORINTERFACE {
        void onBehave(jjOBJ@ obj) {
                obj.behave(BEHAVIOR::BULLET);
                jjPLAYER@ creator = jjPlayers[obj.creatorID];
                if (obj.state == STATE::FLY) {
                        if (obj.counter == 1 && creator.isLocal) {
                                jjSample(creator.xPos, creator.yPos, SOUND::INTRO_BLOW, 48, 30000);
                                jjSample(creator.xPos, creator.yPos, SOUND::COMMON_BIRDFLY, 48, 30000);
                        }
 
                        switch (obj.direction) {
                                case 1: obj.xSpeed = obj.xSpeed - 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
                                case -1: obj.xSpeed = obj.xSpeed + 0.05; obj.ySpeed = obj.ySpeed - 0.1; break;
                        }

                }
                if (obj.state == STATE::EXPLODE) {
                        if (obj.var[0] == 0) {
                                jjSample(obj.xPos, obj.yPos, SOUND::COMMON_SWISH4, 36, 15000);
                                obj.var[0] = 1;
                        }
                }
        }
}