Downloads containing xlmpumpkin.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Pumpkin Park Dragusela Battle N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, WeaponVMega::Boomerang::Weapon(), null, se::RollerMLLEWrapper(), SuperToaster::Weapon(), null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "xlmpumpkin-MLLE-Data-4.j2l" ///@MLLE-Generated
#pragma require "xlmpumpkin-MLLE-Data-3.j2l" ///@MLLE-Generated
#pragma require "xlmpumpkin-MLLE-Data-2.j2l" ///@MLLE-Generated
#pragma require "xlmpumpkin-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "Aztec2.j2t" ///@MLLE-Generated
#pragma require "xlmpumpkin.j2l" ///@MLLE-Generated
#include "SuperToaster.asc" ///@MLLE-Generated
#pragma require "SuperToaster.asc" ///@MLLE-Generated
#include "SEroller-mlle.asc" ///@MLLE-Generated
#pragma require "SEroller-mlle.asc" ///@MLLE-Generated
#include "WeaponVMega1.asc" ///@MLLE-Generated
#pragma require "WeaponVMega1.asc" ///@MLLE-Generated
///@SaveAndRunArgs -server -battle ///@MLLE-Generated
#pragma offer "CandyBunny.png"
#pragma require "spelunky_ignite.wav"
double counter = 135*2;
const int Delay = 100;
string A = "Now entering...";
string B = "By dragusela of XLM";

void onLevelLoad() {
	jjUseLayer8Speeds = true;
	jjAnimSets[ANIM::RAVEN].load();
	generateCustomSpringSprites(jjAnimSets[ANIM::CUSTOM[9]], array<uint> = {40, 16, 64, 88});
        turnIntoCustomSpring(jjObjectPresets[OBJECT::FROZENSPRING], 0, 19.75f, false);
        turnIntoCustomSpring(jjObjectPresets[OBJECT::HORREDSPRING], 1, 22.25f, false);
        turnIntoCustomSpring(jjObjectPresets[OBJECT::HORBLUESPRING], 3, 33.3f, false);
	jjObjectPresets[OBJECT::HORREDSPRING].causesRicochet = jjObjectPresets[OBJECT::HORBLUESPRING].causesRicochet = false;
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT2;
	jjObjectPresets[OBJECT::SILVERCOIN].determineCurAnim(ANIM::PICKUPS, 13);
	jjObjectPresets[OBJECT::WARP].behavior = CandyBunny;

	const jjANIMATION@ booth = jjAnimations[jjAnimSets[ANIM::BONUS].load(
		jjPIXELMAP("CandyBunny.png"),
		42, 61,
		firstAnimToOverwrite: jjAnimSets[ANIM::BONUS],
		firstFrameToOverwrite: jjAnimations[jjAnimSets[ANIM::BONUS]]
	)];
	for (uint i = 0; i < booth.frameCount; ++i) {
		jjANIMFRAME@ frame = jjAnimFrames[booth + i];
		frame.hotSpotX = -23; 
		frame.hotSpotY = -42;

	for (int i = 1; i < 255; i++) {
		jjOBJ@ preset = jjObjectPresets[i];
		if (preset.playerHandling == HANDLING::PICKUP) {
			preset.behavior = CannotBeShotDown(preset.behavior);
		}
	}
	
	jjSampleLoad(SOUND::P2_POEP, "spelunky_ignite.wav");

	}
	jjLayers[1].spriteMode = SPRITE::BLEND_NORMAL;
	jjLayers[1].spriteParam = 255;
}


void onLevelReload() {
	MLLE::SpawnOffgridsLocal();
	MLLE::ReapplyPalette();
}

void onMain() {	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
        jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
}

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



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

void onLevelBegin() {
	MLLE::SpawnOffgrids();
        jjWeapons[2].allowedPowerup = true;
}

void onPlayer(jjPLAYER@ play) {
	jjWeapons[WEAPON::GUN8].gradualAim = play.powerup[WEAPON::GUN8];
	play.lightType = LIGHT::NONE;

	if (play.yPos >= 0) {
		int skill = jjParameterGet(uint16(play.xPos/32), uint16(play.yPos/32), -4, 2);	
		if (skill == 2) {
			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;
		}
	}
}

void CandyBunny(jjOBJ@ obj) {
	array<float> realY(jjLocalPlayerCount);
	for (int i = 0; i < jjLocalPlayerCount; ++i) {
		realY[i] = jjLocalPlayers[i].yPos;
	}
	obj.behave(BEHAVIOR::WARP);
}	

class CannotBeShotDown : jjBEHAVIORINTERFACE {
	CannotBeShotDown(const jjBEHAVIOR &in behavior) {
		originalBehavior = behavior;
	}
	void onBehave(jjOBJ@ obj) {
		obj.behave(originalBehavior);
		if (obj.state == STATE::FLOATFALL)
			obj.state = STATE::FLOAT;
	}
	bool onObjectHit(jjOBJ@ obj, jjOBJ@ bullet, jjPLAYER@ player, int force) {
		if (bullet is null) {
			obj.behavior = originalBehavior;
			if (player.objectHit(obj, force, obj.playerHandling))
				return true;
			obj.behavior = this;
		}
		return false;
	}
	private jjBEHAVIOR originalBehavior;
}

class Raven {
    private float xPos, yPos, xOrg, yOrg, minScale, maxScale;
    private int direction, param;
    
    void setParameters(Raven@ raven, float xOrg, float yOrg, float minScale, float maxScale, int direction, int param) {
        raven.xOrg = xOrg;
        raven.yOrg = yOrg;
        raven.minScale = minScale;
        raven.maxScale = maxScale;
        raven.direction = direction;
        raven.param = param;
    }
    
    void getPosition(Raven@ raven) {
        raven.xPos = jjSin(jjGameTicks)*64*raven.direction + raven.xOrg;
        raven.yPos = jjCos(jjGameTicks)*16*raven.direction + raven.yOrg;
    }
    
    void draw(Raven@ raven, jjCANVAS@ canvas) {
        canvas.drawResizedSprite(int(raven.xPos), int(raven.yPos), ANIM::RAVEN, raven.yPos > (raven.yOrg + 0.24) && raven.yPos < (raven.yOrg + 2.8)? 2:1, jjGameTicks >> 3, raven.yPos >= (raven.yOrg + 2.8)? maxScale:-minScale, raven.yPos >= (raven.yOrg + 2.8)? maxScale:minScale, SPRITE::BRIGHTNESS, param);
    }
}

void onDrawLayer6(jjPLAYER@ play, jjCANVAS@ canvas) {
    array<Raven> ravens(3);
    
    ravens[0].setParameters(ravens[0], 610, 120, 0.68, 0.65, -1, 50);
    ravens[0].getPosition(ravens[0]);
	
	ravens[0].draw(ravens[0], canvas);
	
	ravens[1].setParameters(ravens[1], 130, 320, 0.71, 0.76, 1, 50);
    ravens[1].getPosition(ravens[1]);
    
    ravens[1].draw(ravens[1], canvas);
	
	ravens[2].setParameters(ravens[2], 690, 290, 0.73, 0.78, 1, 50);
    ravens[2].getPosition(ravens[2]);
    
    ravens[2].draw(ravens[2], canvas);
}

bool onDrawGameModeHUD(jjPLAYER@ player, jjCANVAS@ canvas) {
	if (jjGameTicks < Delay + 550) {
	jjTEXTAPPEARANCE title;
	title = STRING::NORMAL;
	title.align = STRING::CENTER;
	canvas.drawString(jjSubscreenWidth/2 - 150, 37, "|" + A.substr(0, (jjGameTicks > Delay) ? (jjGameTicks-Delay)/8 : 0) , STRING::MEDIUM);
	canvas.drawString(jjSubscreenWidth/2, 55, "|||" + jjLevelName, STRING::LARGE, title, 0, SPRITE::BLEND_NORMAL, int(115*(sin((counter/2)*2*3.1415926f/180)+1)+20));
	canvas.drawString(jjSubscreenWidth/2 + 10, 85, "||||" + B.substr(0, (jjGameTicks > 280+Delay) ? (jjGameTicks-280-Delay)/8 : 0) , STRING::MEDIUM);
	if (jjGameTicks > 150+Delay && jjGameTicks < 250+Delay)
		counter++;
	}
	return false;
}