Downloads containing raceEleventy.j2as

Downloads
Name Author Game Mode Rating
JJ2 1.23 vanilla: Miscellaneous stuff Violet CLM Multiple N/A Download file

File preview

void onLevelLoad() {
	//make layer 8
	for (int h = 0; h < 2; ++h)
		for (int v = 0; v < 2; ++v) {
			jjPIXELMAP input(300 + h + v*10);
			array<array<jjPIXELMAP@>> outputs(4, array<jjPIXELMAP@>(4));
			for (int hh = 0; hh < 4; ++hh)
				for (int vv = 0; vv < 4; ++vv)
					@outputs[hh][vv] = @jjPIXELMAP(0);
			for (int hh = 0; hh < 32; ++hh)
				for (int vv = 0; vv < 32; ++vv)
					for (int hhh = 0; hhh < 4; ++hhh)
						for (int vvv = 0; vvv < 4; ++vvv) {
							outputs[hh / 8][vv / 8][(hh % 8) * 4 + hhh, (vv % 8) * 4 + vvv] = input[hh,vv];
						}
			for (int hh = 0; hh < 4; ++hh)
				for (int vv = 0; vv < 4; ++vv)
					outputs[hh][vv].save(10 + h*4 + hh + (v*4 + vv)*10);
		}
		
	jjAnimSets[ANIM::CUSTOM[0]].allocate(array<uint> = {1, 4, 4});
	
	jjPIXELMAP Fooruman(0, 64, 64, 64, 4);
	jjANIMFRAME@ frame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::CUSTOM[0]]]];
	Fooruman.save(frame);
	frame.hotSpotX = -frame.width / 2;
	frame.hotSpotY = -frame.height / 2;
	
	for (int y = 0; y < 2; ++y)
		for (int i = 0; i < 4; ++i) {
			jjPIXELMAP spark(594 + i + y*10);
			@frame = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::CUSTOM[0]] + 1 + y] + i];
			spark.save(frame);
			frame.hotSpotX = -frame.width / 2;
			frame.hotSpotY = -frame.height / 2;
		}
		
	for (int i = jjLocalPlayerCount; i >= 1; --i)
		for (int j = 0; j < 2; ++j) {
			jjAddObject(OBJECT::SPARK, j, 0, jjLocalPlayers[i].playerID, CREATOR::PLAYER, Sandopolis);
		}
		
	jjPIXELMAP Goblet(256);
	@frame = jjAnimFrames[jjObjectPresets[OBJECT::MILK].curFrame];
	Goblet.save(frame);
	frame.hotSpotX = -frame.width / 2;
	frame.hotSpotY = -frame.height / 2;
	jjPIXELMAP Gem(116);
	@frame = jjAnimFrames[jjObjectPresets[OBJECT::BLUEGEM].curFrame];
	jjAnimations[jjObjectPresets[OBJECT::BLUEGEM].curAnim].frameCount = 1;
	Gem.save(frame);
	frame.hotSpotX = -frame.width / 2;
	frame.hotSpotY = -frame.height / 2;
	
	for (int h = 79; h <= 113; ++h)
		for (int v = 43; v <= 47; ++v)
			jjParameterSet(h, v, 0, 5, jjRandom() & 31);
}

void onPlayer(jjPLAYER@ play) {
	
	jjCharacters[play.charCurr].airJump = AIR::NONE;
	if (play.jumpStrength < -11) {
		if (play.ySpeed < -5)
			play.jumpStrength = -10;
		jjObjects[jjAddObject(OBJECT::SHARD, play.xPos, play.yPos + 24, play.playerID, CREATOR::PLAYER, BEHAVIOR::BOUNCEONCE)].determineCurAnim(ANIM::CUSTOM[0], 1 + (jjRandom() & 1));
	}
	
	if ((jjGameTicks % 280) == 200) {
		play.lighting = play.lighting - 10;
		if (play.lighting < 14)
			play.lighting = 14;
	}
}
void onMain() {
	if ((jjGameTicks & 31) == 0)
		for (int i = 0; i < 32; ++i)
			jjTriggers[i] = (jjRandom() & 1) == 1;
	for (int i = jjObjectCount - 1; i >= 1; --i) {
		jjOBJ@ obj = jjObjects[i];
		if (obj.eventID == OBJECT::REDSPRING)
			obj.yPos = obj.yOrg + 10 + jjSin(jjGameTicks * 7) * 30;
	}
}

void Sandopolis(jjOBJ@ obj) {
	if (obj.state == STATE::START) {
		obj.determineCurAnim(ANIM::CUSTOM[0], 0);
		obj.determineCurFrame();
		obj.direction = (obj.xOrg > 0) ? 1 : -1;
		obj.xOrg = obj.xAcc = -300;
		obj.yOrg = obj.yAcc = -200;
		obj.state = STATE::FLY;
		obj.lightType = LIGHT::BRIGHT;
		obj.light = 10;
		obj.bulletHandling = HANDLING::DETECTBULLET;
		obj.playerHandling = HANDLING::SPECIAL;
		obj.scriptedCollisions = true;
	}
	jjPLAYER@ play = jjPlayers[obj.creatorID];
	if (play.lighting == 100 || obj.yAcc > 666) {
		obj.xAcc = obj.xOrg;
		obj.yAcc = obj.yOrg;
	}
	float speed = (100 - play.lighting) / 65.f;
	if (speed != 0)	speed += (jjRandom() & 3) / 5.f;;
	obj.xPos = (obj.xAcc += speed) * obj.direction + play.cameraX + jjResolutionWidth/2;
	obj.yPos = (obj.yAcc += speed * 0.66) + play.cameraY + jjResolutionHeight/2 + jjSin(jjGameTicks * 16) * 6;
	obj.draw();
}

void onObjectHit(jjOBJ@ obj, jjOBJ@ bull, jjPLAYER@ play, int force) {
	if (obj.behavior == Sandopolis) {
		obj.particlePixelExplosion(bull is null ? 2 : 0);
		obj.xAcc = obj.xOrg;
		obj.yAcc = obj.yOrg;
		if (bull is null) {
			play.stoned = 210;
			//jjSamplePriority(SOUND::STONED_STONED);
			play.showText("@@@HAHAHA!!!!!!", STRING::MEDIUM);
		} else {
			play.showText("@@@AAAAHHH FOO", STRING::MEDIUM);
		}
		
	}
}

void onFunction0(jjPLAYER@ play) {
	play.jumpStrength = -20;
}