Downloads containing xlmscar.j2as

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

File preview

#pragma require "AntiGravBouncer.j2a"
#pragma require "xlmscar.j2l"
#pragma require "xlmscar.j2t"
array<SOUND::Sample> BouncerS = {SOUND::AMMO_GUNFLP,SOUND::AMMO_GUNFLP1,SOUND::AMMO_GUNFLP2,SOUND::AMMO_GUNFLP3,SOUND::AMMO_GUNFLP4,SOUND::AMMO_GUNFLPL};
array<SOUND::Sample> BouncerPUS = {SOUND::AMMO_BMP1,SOUND::AMMO_BMP2,SOUND::AMMO_BMP3,SOUND::AMMO_BMP4,SOUND::AMMO_BMP5,SOUND::AMMO_BMP6};

void Verticalbouncer(jjOBJ@ obj) {
    if (obj.state == STATE::START) {
		if (obj.direction != 0) {
			obj.ySpeed = -0.99743;
			obj.yAcc = -0.469733;
		}
		else if (obj.direction == 0) {
			obj.yAcc *= -0.5;
			obj.ySpeed *= -1;
		}
		if (obj.eventID == OBJECT::ICEBULLET) {
			jjSample(obj.xPos, obj.yPos, SOUND::BouncerS[jjRandom() & 5], 63);
		}
		else if (obj.eventID == OBJECT::ICEBULLETPU) {
			jjSample(obj.xPos, obj.yPos, SOUND::BouncerPUS[jjRandom() & 5], 63);
		}
		obj.state = STATE::FLY;
	}
	if (obj.eventID == OBJECT::ICEBULLET) {
		if (obj.direction == 0 && jjMaskedPixel(int(obj.xPos), obj.yPos + (obj.ySpeed * 2))) {
			obj.yAcc -= 0.10;
			obj.ySpeed -= 0.5;
		}
	}
	else if (obj.eventID == OBJECT::ICEBULLETPU) {
		if (obj.direction == 0 && jjMaskedPixel(int(obj.xPos), (int(obj.yPos)) + 0.8)) {
			obj.yAcc -= 0.10;
			obj.ySpeed -= 0.5;
		}
	}
	obj.behave(bouncer);
}

void bouncer(jjOBJ@ obj) {
    float xSpeed = obj.xSpeed;
    float ySpeed = obj.ySpeed;
	if (obj.eventID == OBJECT::ICEBULLET || obj.eventID == OBJECT::BOUNCERBULLET) {
    obj.behave(BEHAVIOR::BOUNCERBULLET);
	}
	if (obj.eventID == OBJECT::ICEBULLETPU ||obj.eventID == OBJECT::BOUNCERBULLETPU) {
    obj.behave(BEHAVIOR::BOUNCERBULLETPU);
	}
    if (xSpeed * obj.xSpeed < 0.f && ySpeed * obj.ySpeed < 0.f) {
        if (!jjMaskedPixel(int(obj.xPos + obj.xSpeed), int(obj.yPos + ySpeed))) {
            obj.var[0] = obj.var[0] - 1;
            obj.ySpeed = ySpeed;
            if (ySpeed > 0.f)
                obj.yPos += ySpeed;
        }
    }
}
void onLevelLoad() {

	jjTexturedBGFadePositionY = 0.85;

	jjDelayGeneratedCrateOrigins = true;
	
	jjObjectPresets[OBJECT::BOUNCERBULLET].behavior = bouncer;
	jjObjectPresets[OBJECT::BOUNCERBULLETPU].behavior = bouncer;

	jjAnimSets[ANIM::CUSTOM[1]].load(0, "AntiGravBouncer.j2a");
	
	jjWeapons[WEAPON::ICE].spread = SPREAD::NORMAL;
	jjWeapons[WEAPON::ICE].style = WEAPON::NORMAL;
	jjWeapons[WEAPON::ICE].replacedByBubbles = false;
	jjWeapons[WEAPON::ICE].defaultSample = false;
	jjWeapons[WEAPON::ICE].multiplier = 1;
	
	jjObjectPresets[OBJECT::ICEBULLET].special = jjObjectPresets[OBJECT::ICEBULLET].determineCurAnim(ANIM::CUSTOM[1], 0);
	jjObjectPresets[OBJECT::ICEBULLET].xSpeed = 5;
	jjObjectPresets[OBJECT::ICEBULLET].freeze = 0;
	jjObjectPresets[OBJECT::ICEBULLET].counterEnd = (70*3)/2;
	jjObjectPresets[OBJECT::ICEBULLET].xAcc = 0.25;
	jjObjectPresets[OBJECT::ICEBULLET].lightType = jjObjectPresets[OBJECT::BOUNCERBULLET].lightType;
	jjObjectPresets[OBJECT::ICEBULLET].killAnim = jjObjectPresets[OBJECT::BOUNCERBULLET].killAnim;
	jjObjectPresets[OBJECT::ICEBULLET].lightType = LIGHT::POINT2;
	jjObjectPresets[OBJECT::ICEBULLET].behavior = Verticalbouncer;
	jjObjectPresets[OBJECT::ICEBULLET].var[6] = 0;
	jjObjectPresets[OBJECT::ICEAMMO15].determineCurAnim(ANIM::CUSTOM[1], 5);
	jjObjectPresets[OBJECT::ICEAMMO15].determineCurFrame();
	jjAnimations[jjAnimSets[ANIM::AMMO] + 29] = jjAnimations[jjAnimSets[ANIM::CUSTOM[1]] + 3];
	
	jjObjectPresets[OBJECT::ICEBULLETPU].special = jjObjectPresets[OBJECT::ICEBULLETPU].determineCurAnim(ANIM::CUSTOM[1], 1);
	jjObjectPresets[OBJECT::ICEBULLETPU].xSpeed = 5;
	jjObjectPresets[OBJECT::ICEBULLETPU].freeze = 0;
	jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = (70*3)/2;
	jjObjectPresets[OBJECT::ICEBULLETPU].xAcc = 0.25;
	jjObjectPresets[OBJECT::ICEBULLETPU].lightType = jjObjectPresets[OBJECT::BOUNCERBULLETPU].lightType;
	jjObjectPresets[OBJECT::ICEBULLETPU].killAnim = jjObjectPresets[OBJECT::BOUNCERBULLET].killAnim;
	jjObjectPresets[OBJECT::ICEBULLETPU].lightType = LIGHT::POINT2;
	jjObjectPresets[OBJECT::ICEBULLETPU].behavior = Verticalbouncer;
	jjObjectPresets[OBJECT::ICEBULLETPU].var[6] = 8;
	jjObjectPresets[OBJECT::ICEPOWERUP].determineCurAnim(ANIM::CUSTOM[1], 4);
	jjAnimations[jjAnimSets[ANIM::AMMO] + 28] = jjAnimations[jjAnimSets[ANIM::CUSTOM[1]] + 2];

	
  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;
	        }
	   }
	}
}