Downloads containing ab23ctf08.j2as

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

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, se::RollerMLLEWrapper(), null, null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab23ctf08-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "ab23ctf08-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab23ctf08.j2l" ///@MLLE-Generated
#include "SEroller-mlle.asc" ///@MLLE-Generated
#pragma require "SEroller-mlle.asc" ///@MLLE-Generated

void onLevelLoad() {
	jjAnimSets[ANIM::SKELETON].load();

	jjUseLayer8Speeds = true;

	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 48, 88, 32});
    turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 26.55f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORGREENSPRING], 2, 17.75f, false);
    turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
	turnIntoCustomSpring(jjObjectPresets[OBJECT::BLUESPRING], 4, 32.3f, false);
	
	
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = jjObjectPresets[OBJECT::HORGREENSPRING].causesRicochet = false;
	
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 53;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	
	jjObjectPresets[OBJECT::ICEBULLET].counterEnd = 85;
	jjObjectPresets[OBJECT::ICEBULLETPU].counterEnd = 105;
	
	jjObjectPresets[OBJECT::SEEKERPOWERUP].direction = SPRITE::FLIPH;
	
	jjObjectPresets[OBJECT::GUNCRATE].behavior = ColoredCrate();
	jjObjectPresets[OBJECT::SHARD].behavior = ColoredCrate();
}
	
void onMain() {	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
    jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
	
	for (int i = 1; i < jjObjectCount; i++) {
        jjOBJ@ obj = jjObjects[i];
        if (obj.eventID == OBJECT::RFPOWERUP) {
            obj.direction = obj.xPos < (jjLayerWidth[4]*32)/2? -1:0;
        }
    }
	
}

void onLevelBegin() {
	for (int i = 1; i < jjObjectCount; i++) {
		if (jjObjects[i].eventID == OBJECT::CTFBASE || jjObjects[i].behavior == BEHAVIOR::FLAG) jjObjects[i].yOrg += 9;
	}
}

void onPlayer(jjPLAYER@ player){
	player.lightType = LIGHT::NONE;
	
	handleFastCustomSpringSpeeds(player);
	
	if (player.yPos >= 0) {
		//Wherein "skill 3" means "MP Only"
		int skill = jjParameterGet(uint16(player.xPos/32), uint16(player.yPos/32), -4, 2);	
		if (skill == 3) {
			if (jjLayers[1].spriteParam > 96) {
				if (jjLayers[1].spriteParam == 255) jjSamplePriority(SOUND::P2_POEP);
				jjLayers[1].spriteParam = jjLayers[1].spriteParam - 10;
			}
		}
		else if (jjLayers[1].spriteParam != 255) {
			jjLayers[1].spriteParam = jjLayers[1].spriteParam + 10;
		}
	}
}

jjANIMSET@ customSpringSprite;
array<int> fastCustomSpringSpeeds(jjLocalPlayerCount);
bool generateCustomSpringSprites(jjANIMSET@ anim, const array<uint> &in colors) {
    int length = colors.length();
    bool success = (@customSpringSprite = anim).allocate(array<uint>(length * 3, 5)) !is null;
    if (success) {
        uint srcSet = jjAnimSets[ANIM::SPRING];
        for (int i = 0; i < length; i++) {
            uint color = colors[i];
            uint destAnimOffset = anim + i * 3;
            for (int j = 0; j < 3; j++) {
                uint srcAnim = jjAnimations[srcSet + j];
                uint destAnim = jjAnimations[destAnimOffset + j];
                for (int k = 0; k < 5; k++) {
                    jjPIXELMAP image(jjAnimFrames[destAnim + k] = jjAnimFrames[srcAnim + k]);
                    int width = image.width;
                    int height = image.height;
                    for (int l = 0; l < height; l++) {
                        for (int m = 0; m < width; m++) {
                            int pixel = image[m, l];
                            if (pixel >= 32 && pixel < 40)
                                image[m, l] = color + (pixel & 7);
                        }
                    }
                    if (!image.save(jjAnimFrames[destAnim + k]))
                        return false;
                }
            }
        }
    }
    return success;
}
void initializeCustomSpring(jjOBJ@ obj) {
    int anim = obj.curAnim;
    obj.behave(obj.behavior = BEHAVIOR::SPRING, false);
    if (obj.curAnim != anim) {
        obj.curAnim = anim + 2;
        obj.determineCurFrame();
    }
    obj.draw();
}
 
void turnIntoCustomSpring(jjOBJ@ obj, uint color, float power, bool horizontal) {
    if (horizontal) {
        obj.xSpeed = power;
        obj.ySpeed = 0.f;
    } else {
        obj.xSpeed = 0.f;
        obj.ySpeed = -power;
        if (obj.state == STATE::START && obj.creatorType == CREATOR::LEVEL) {
            int x = int(obj.xPos) >> 5;
            int y = int(obj.yPos) >> 5;
            if (jjParameterGet(x, y, 0, 1) != 0) {
                jjParameterSet(x, y, 0, 1, 0);
                obj.yPos -= 4.f;
                obj.ySpeed = power;
            }
        }
    }
    obj.behavior = initializeCustomSpring;
    obj.curAnim = customSpringSprite + color * 3 + (horizontal ? 1 : 0);
    obj.energy = obj.frameID = obj.freeze = obj.justHit = obj.light = obj.points = 0;
    obj.isBlastable = obj.isTarget = obj.scriptedCollisions = obj.triggersTNT = false;
    obj.deactivates = obj.isFreezable = true;
    obj.bulletHandling = HANDLING::IGNOREBULLET;
    obj.playerHandling = HANDLING::SPECIAL;
    obj.lightType = LIGHT::NORMAL;
    obj.determineCurFrame();
}
 
void handleFastCustomSpringSpeeds(jjPLAYER@ play) {
        if (play.ySpeed < -32.f) {
                fastCustomSpringSpeeds[play.localPlayerID] = int(ceil((play.ySpeed + 32.f) / -0.125f));
        } else if (fastCustomSpringSpeeds[play.localPlayerID] != 0) {
                if (play.ySpeed < -31.f) {
                        fastCustomSpringSpeeds[play.localPlayerID]--;
                        play.ySpeed = -32.f;
                } else {
                        fastCustomSpringSpeeds[play.localPlayerID] = 0;
                }
        }
}
void onDrawLayer4(jjPLAYER@ play, jjCANVAS@ canvas) {
	canvas.drawSprite(((36*32) + 22), ((53*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((39*32) + 8), ((55*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((24*32) + 8), ((18*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((34*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((28*32) + 22), ((20*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((37*32) + 22), ((35*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((58*32) + 8), ((30*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((62*32) + 22), ((56*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((56*32) + 22), ((32*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((51*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((60*32) + 22), ((17*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((62*32) + 8), ((19*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((68*32) + 22), ((18*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((68*32) + 22), ((43*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((84*32) + 22), ((44*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((87*32) + 22), ((57*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((100*32) + 22), ((15*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((121*32) + 22), ((64*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((130*32) + 22), ((22*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((132*32) + 22), ((28*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((135*32) + 22), ((53*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((114*32) + 22), ((54*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((97*32) + 22), ((60*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((93*32) + 22), ((37*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((122*32) + 22), ((34*32) + 50), ANIM::SKELETON, 2, 6, -1, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((71*32) + 8), ((42*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((79*32) + 8), ((25*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((103*32) + 8), ((49*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((101*32) + 8), ((36*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((102*32) + 8), ((16*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((128*32) + 8), ((66*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64); //RIGHT
	canvas.drawSprite(((89*32) + 8), ((58*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((125*32) + 8), ((17*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((112*32) + 8), ((52*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((120*32) + 8), ((33*32) + 50), ANIM::SKELETON, 2, 6, 0, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((124*32) + 32), ((74*32) - 10), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((94*32) + 32), ((71*32) + 3), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	
}
void onDrawLayer3(jjPLAYER@ play, jjCANVAS@ canvas) {
// GROUND ONES
	canvas.drawSprite(((22*32) + 32), ((37*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64); // RIGHT
	canvas.drawSprite(((44*32) + 32), ((69*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64); // LEFT
	canvas.drawSprite(((49*32) + 32), ((70*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((61*32) + 32), ((72*32) + 11), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((27*32) + 32), ((73*32) + 7), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((108*32) + 38), ((20*32) - 4), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);

	
	canvas.drawSprite(((112*32) + 32), ((26*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((137*32) + 32), ((56*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((44*32) + 32), ((69*32) - 4), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	
// DAMN ONES
	canvas.drawSprite(((50*32) + 16), ((40*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((57*32) + 16), ((66*32) - 13), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((65*32) + 16), ((51*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((58*32) + 11), ((27*32) - 26), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	
	canvas.drawSprite(((84*32) + 16), ((30*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((101*32) + 16), ((30*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((104*32) + 16), ((67*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((129*32) + 16), ((60*32) - 19), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((85*32) + 16), ((52*32) - 6), ANIM::SKELETON, 2, 12, 0, SPRITE::SINGLEHUE, 64);

	
	canvas.drawSprite(((72*32) + 16), ((34*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((109*32) + 16), ((40*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((114*32) + 16), ((70*32) - 19), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);
	canvas.drawSprite(((74*32) + 16), ((62*32) - 6), ANIM::SKELETON, 2, 12, -1, SPRITE::SINGLEHUE, 64);

}

bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

class ColoredCrate : jjBEHAVIORINTERFACE {
    int color;
    void onBehave(jjOBJ@ obj) {
        obj.behave(obj.eventID == OBJECT::GUNCRATE? BEHAVIOR::CRATE : BEHAVIOR::SHARD);
        
        if (obj.state == STATE::KILL) {
            obj.delete();
        }
    }
    void onDraw(jjOBJ@ obj) {
        color = jjParameterGet(int(obj.xOrg/32), int(obj.yOrg/32)+ (jjEventGet(int(obj.xOrg/32), int(obj.yOrg/32)) == 255? 0:1), 0, 8);
        jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, color == 0? SPRITE::NORMAL : SPRITE::SINGLEHUE, color);
		
    }
}