Downloads containing HH18_level07.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Holiday Hare '18Featured Download SmokeNC Single player 8.9 Download file

File preview

#include "MLLE-Include-1.4.asc"
const bool MLLESetupSuccessful = MLLE::Setup();
#pragma require "top secret ][ 2.j2t"
#pragma require "Odyssey01.j2t"
#pragma require "HH18_level07-MLLE-Data-2.j2l"
#pragma require "Castle1.j2t"
#pragma require "LomatLn.j2t"
#pragma require "HH18_level07-MLLE-Data-1.j2l"
#pragma require "HH18_level07.j2l"
#pragma require "HH18E1.j2a"
#include "HH18Smoke.asc"
#pragma require "SExmas.j2a"
#include "HH17Enemies.asc"
#include "HH18savegems.asc"

class Imitation : jjBEHAVIORINTERFACE {
	private uint8 eventID;
	private jjBEHAVIOR behavior;
	Imitation(uint8 realEventID, uint8 fakeEventID) {
		jjOBJ@ obj = jjObjectPresets[realEventID];
		eventID = obj.eventID;
		behavior = obj.behavior;
		obj.eventID = fakeEventID;
		obj.behavior = this;
	}
	void onBehave(jjOBJ@ obj) override {
		if (obj.state == STATE::DEACTIVATE)
			obj.eventID = eventID;
		obj.behave(behavior);
	}
}
class GiftBox : jjBEHAVIORINTERFACE {
	void destroy(jjOBJ@ obj) {
		jjSample(obj.xPos, obj.yPos, SOUND::COMMON_WOOD1);
		{
			int id = jjAddObject(OBJECT::EXPLOSION, obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				other.determineCurAnim(ANIM::PICKUPS, 4);
			}
		}
		for (int i = jjRandom() & 7 | 8; i-- != 0;) {
			int id = jjAddObject(OBJECT::SHARD, obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				other.determineCurAnim(ANIM::PICKUPS, 93 + (jjRandom() & 1));
			}
		}
		obj.yPos -= 8.f;
		for (int i = obj.var[1]; i-- != 0;) {
			int id = jjAddObject(obj.var[0], obj.xPos, obj.yPos);
			if (id != 0) {
				jjOBJ@ other = jjObjects[id];
				if (other.playerHandling == HANDLING::PICKUP) {
					int angle = (jjRandom() & 255) + 128;
					other.xSpeed = jjCos(angle) * 5.f;
					other.ySpeed = jjSin(angle) * -3.f;
				} else if (other.playerHandling == HANDLING::SPECIAL) {
					other.deactivates = false;
				}
			}
		}
		obj.clearPlatform();
		obj.delete();
	}
	void onBehave(jjOBJ@ obj) override {
		switch (obj.state) {
			case STATE::START:
				{
					uint16 x = int(obj.xOrg) >>> 5;
					uint16 y = int(obj.yOrg) >>> 5;
					obj.var[0] = jjParameterGet(x, y, 0, 8);
					obj.var[1] = jjParameterGet(x, y, 8, 4);
					obj.curAnim += jjParameterGet(x, y, 12, 2);
					obj.determineCurFrame();
					obj.bulletHandling = HANDLING::DESTROYBULLET;
					obj.scriptedCollisions = true;
				}
				break;
			case STATE::FALL:
				obj.var[2] = 1;
				break;
			case STATE::FREEZE:
			case STATE::SLEEP:
				if (obj.var[2] != 0) {
					destroy(obj);
					return;
				}
		}
		obj.behave(BEHAVIOR::MONITOR);
	}
	bool onObjectHit(jjOBJ@, jjOBJ@, jjPLAYER@, int) {
		return true;
	}
	bool onIsSolid(jjOBJ@) {
		return true;
	}
}

void onLevelLoad()
{
	gem::restorePlayerGems();
	jjObjectPresets[OBJECT::SPIKEBOLL].energy = 0;

	Imitation(OBJECT::TACO, OBJECT::MILK);
	uint src = jjAnimSets[ANIM::CUSTOM[255]].load(0, "SExmas.j2a");
	uint dest = jjAnimSets[ANIM::PICKUPS];
	for (int i = 0; i < 95; i++) {
		const jjANIMATION@ anim = jjAnimations[src + i];
		if (anim.frameCount != 0)
			jjAnimations[dest + i] = anim;
	}
	jjAnimSets[ANIM::BRIDGE].load(1, "SExmas.j2a");
	jjAnimSets[ANIM::CUSTOM[0]].load(2, "SExmas.j2a");
	jjObjectPresets[OBJECT::ONEUPCRATE].behavior = GiftBox();
    jjObjectPresets[OBJECT::ONEUPCRATE].determineCurAnim(ANIM::CUSTOM[0], 0);

	jjUseLayer8Speeds = true;
	jjTexturedBGTexture = TEXTURE::DIAMONDUSBETA;
	
SMOKE::MECHABEAR(OBJECT::DEMON,3);
SMOKE::ICEDRAGON(OBJECT::DRAGONFLY,OBJECT::CRAB);
SMOKE::CRYSTALKNIGHT(OBJECT::RAPIER,3);

	HH17::setEnemy(OBJECT::TUFTURT);
	HH17::setEnemy(OBJECT::RAVEN);
	HH17::setEnemy(OBJECT::LABRAT);
	HH17::setEnemy(OBJECT::SKELETON);
	HH17::setEnemy(OBJECT::FLOATSUCKER);
	HH17::setEnemy(OBJECT::SUCKER);
	HH17::setEnemy(OBJECT::MONKEY);
	HH17::setEnemy(OBJECT::STANDMONKEY);
	HH17::setEnemy(OBJECT::BAT);
	HH17::setEnemy(OBJECT::BEE);
	
	// jjObjectPresets[OBJECT::BEE].determineCurFrame();
	// jjObjectPresets[OBJECT::BEE].behavior = SnowBee;
	
	jjIsSnowing = true;
	
	jjWeapons[WEAPON::GUN8].comesFromGunCrates = true;
	jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
	jjWeapons[WEAPON::SEEKER].comesFromGunCrates = false;
	
	array<int> BarrelSprites = {3,6,7,8,9};
        for (uint i = 0; i < BarrelSprites.length(); i++) {
                jjANIMATION@ animBarrel = jjAnimations[jjAnimSets[ANIM::PICKUPS] + BarrelSprites[i]];
                for (uint j = 0; j < animBarrel.frameCount; j++) {
                        jjANIMFRAME@ frame = jjAnimFrames[animBarrel + j];
                        jjPIXELMAP sprite(frame);
                        for (uint x = 0; x < sprite.width; ++x) {
                                for (uint y = 0; y < sprite.height; ++y) {
                                        if (sprite[x,y] == 40) sprite[x,y] = 24;
                                        if (sprite[x,y] == 53) sprite[x,y] = 41;
                                        if (sprite[x,y] >= 56 && sprite[x,y] <= 62) sprite[x,y] -= 31;
                                        if (sprite[x,y] >= 80 && sprite[x,y] <= 87) sprite[x,y] -= 64;
                                }
                        }
                        sprite.save(frame);
                }
        }
}

void onLevelReload() {
	MLLE::Palette.apply();
	HH17::processEnemyColors(); //ensure that enemy colors are still displaying correctly when the level reloads after death
	gem::restorePlayerGems();
}

void onMain() {
    HH17::handleEnemyProjectiles(); //this is required to handle the modifications to enemy bullets from the Monkeys and Dragons
	gem::deleteCollectedGems();
}

void onFunction0(jjPLAYER@ play) {
	jjIsSnowing = true;
}

void onFunction1(jjPLAYER@ play) {
	jjIsSnowing = false;
}

void onFunction2(jjPLAYER@ play) {
	gem::saveGemData();
	jjNxt(false, false);
}

bool onDrawLives(jjPLAYER@ play, jjCANVAS@ canvas)  { return true; }

void onPlayer(jjPLAYER@ play) {
	gem::trackPlayerGems(play);
	gem::upgradeHealth(play);
}

/* void SnowBee(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BEE,false);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::PALSHIFT, 231);
} */