Downloads containing LapFestEx.j2as

Downloads
Name Author Game Mode Rating
JJ2+ Only: Lapper FestiveFeatured Download Violet CLM Tileset conversion 9.2 Download file

File preview

void onLevelLoad() {
	jjLayers[6].spriteMode = SPRITE::PALSHIFT;
	jjLayers[6].spriteParam = 16*3;
	jjLayers[6].yOffset = -75;
	
	jjPIXELMAP rockImage(0,0, 96,96, 5);
	jjANIMFRAME@ rockFrame = jjAnimFrames[jjObjectPresets[OBJECT::ROTATINGROCK].curFrame];
	rockImage.save(rockFrame);
	rockFrame.hotSpotY -= 8;
	
	uint giftAnimID = jjAnimSets[ANIM::CUSTOM[0]].allocate(array<uint> = {3,1,1,1,1, 3,1,1,1,1, 3,1,1,1,1});
	for (uint color = 0; color < 3; ++color, ++giftAnimID) {
		const uint y = (3 + color) * 32;
		for (uint state = 0; state < 3; ++state) {
			jjANIMFRAME@ boxFrame = jjAnimFrames[jjAnimations[giftAnimID] + state];
			jjPIXELMAP(state * 64 + 13, y, 48,32, 5).save(boxFrame);
			boxFrame.hotSpotX = -24;
			boxFrame.hotSpotY = 0;
		}
		for (uint shard = 0; shard < 4; ++shard) {
			jjANIMFRAME@ shardFrame = jjAnimFrames[jjAnimations[++giftAnimID]];
			jjPIXELMAP((6 + shard) * 32, y, 32,32, 5).save(shardFrame);
			shardFrame.hotSpotX = shardFrame.hotSpotY = -16;
		}
	}
	
	jjObjectPresets[OBJECT::GUNCRATE].behavior = 
	jjObjectPresets[OBJECT::CARROTCRATE].behavior = 
	jjObjectPresets[OBJECT::ONEUPCRATE].behavior = 
	jjObjectPresets[OBJECT::BOMBCRATE].behavior = 
	jjObjectPresets[OBJECT::SPRINGCRATE].behavior = 
	jjObjectPresets[OBJECT::GEMCRATE].behavior = 
	jjObjectPresets[OBJECT::BOUNCERAMMO15].behavior = 
	jjObjectPresets[OBJECT::ICEAMMO15].behavior = 
	jjObjectPresets[OBJECT::SEEKERAMMO15].behavior = 
	jjObjectPresets[OBJECT::RFAMMO15].behavior = 
	jjObjectPresets[OBJECT::TOASTERAMMO15].behavior = 
		Gift;
		
	jjObjectPresets[OBJECT::DESTRUCTSCENERY].behavior = Lamp;
		
	auto layers = jjLayerOrderGet();
	jjLayerYOffset[7] = -3 * 32 + 10;
	for (uint additionalLayerID = 0; additionalLayerID < 4; ++additionalLayerID) {
		jjLAYER mountains(jjLayers[7]);
		mountains.yOffset = jjLayerYOffset[7] + (additionalLayerID + 1) * (40 * 32 + 52);
		mountains.xSpeed = jjLayerXSpeed[7] * (4 - additionalLayerID) / 6;
		mountains.ySpeed -= 0.03 * (additionalLayerID + 1);
		layers.insertAt(additionalLayerID + 7, mountains);
	}
	jjLayerOrderSet(layers);
}

void onDrawLayer8(jjPLAYER@, jjCANVAS@ canvas) {
	canvas.drawRectangle(0, 8*32, 25*32, 8*32, 203, SPRITE::TRANSLUCENT);
}

[SOLID]
void Gift(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		obj.determineCurAnim(ANIM::CUSTOM[0], (jjRandom() % 3) * 5);
		obj.frameID = 0;
		obj.determineCurFrame();
		obj.behave(BEHAVIOR::CRATE, false);
	} else if (obj.state == STATE::DONE) {
		//obj.beSolid();
		obj.draw();
	} else if (obj.state == STATE::ACTION) {
		obj.behave(BEHAVIOR::CRATE, false);
		if (jjGameConnection == GAME::LOCAL) {
			obj.state = STATE::DONE;
			obj.creatorType = CREATOR::OBJECT;
			obj.behavior = Gift;
			obj.playerHandling = HANDLING::SPECIALDONE;
			obj.bulletHandling = HANDLING::IGNOREBULLET;
			obj.curFrame = jjAnimations[obj.curAnim] + 2;
			obj.justHit = 0;
			obj.draw();
			uint shardID = 0;
			for (uint objectID = jjObjectCount; --objectID != 0;) {
				jjOBJ@ shard = jjObjects[objectID];
				if (shard.eventID == OBJECT::SHARD && shard.isActive && shard.xOrg == obj.xPos && shard.yOrg == obj.yPos)
					shard.curAnim = obj.curAnim + 1 + (shardID++ & 3);
			}
		} else {
			obj.delete();
		}
	} else {
		obj.behave(BEHAVIOR::CRATE);
		jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos - 32, obj.curFrame + 1, 1);
	}
}

void Lamp(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		obj.behave(BEHAVIOR::DESTRUCTSCENERY, false);
		if ((jjTileGet(4, uint(obj.xOrg) >> 5, uint(obj.yOrg) >> 5) & TILE::RAWRANGE) == 361) {
			obj.lightType = LIGHT::NORMAL;
			obj.light = 11;
		}
	} else {
		obj.behave(BEHAVIOR::DESTRUCTSCENERY, false);
		if (obj.state == STATE::DONE) {
			obj.lightType = LIGHT::NONE;
			obj.behavior = BEHAVIOR::DESTRUCTSCENERY;
		}
	}
}