View Single Post
DennisKainz DennisKainz's Avatar

JCF Member

Joined: Dec 2005

Posts: 416

DennisKainz is notorious for his worthless posts

Dec 21, 2015, 02:18 AM
DennisKainz is offline
Reply With Quote
I have this script:
Code:
void onLevelLoad() {
	jjAnimSets[ANIM::CUSTOM[0]].load(0, "sausage.j2a");
	jjObjectPresets[OBJECT::WEENIE].determineCurAnim(ANIM::CUSTOM[0], 0);
	jjTileType[659] = 5;
	jjTileType[669] = 5; // White hot lava.
	jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1);
	jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1);
	jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1);
	jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1);
	jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1);
	jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1);
	jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1);
	jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1);
	jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1);
	jjPalette.apply();
	}
	
void onLevelReload() {
	jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1);
	jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1);
	jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1);
	jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1);
	jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1);
	jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1);
	jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1);
	jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1);
	jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1);
	jjPalette.apply();
	}
	
void onMain() {
	jjUseLayer8Speeds = true; // The long awaited feature that changed my gaming experience!
	jjSetFadeColors(200);
	jjTexturedBGTexture = TEXTURE::WTF;
	}

void onPlayer(jjPLAYER@ jjP) {
	if (jjGameTicks % 7 == 6)
	{
		jjPalette.gradient(128 + (jjP.cameraY / 16), 192 + (jjP.cameraY / 32), 255, 0 + (jjP.cameraY / 8), 32 + (jjP.cameraY / 12), 128, 144, 16, 1);
		jjPalette.gradient(112 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 24), 32 - (jjP.cameraY / 64), 0 + (jjP.cameraY / 12), 0, 0, 160, 16, 1);
		jjPalette.gradient(255, 128, 0, 0 + (jjP.cameraY / 16), 0 + (jjP.cameraY / 256), 0, 208, 24, 1);
		jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 96, 8, 1);
		jjPalette.gradient(0 + (jjP.cameraY / 8), 192 - (jjP.cameraY / 16), 0, 0, 0, 0, 128, 8, 1);
		jjPalette.gradient(128 + (jjP.cameraY / 16), 64 + (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 16), 0, 0, 176, 32, 1);
		jjPalette.gradient(192 + (jjP.cameraY / 32), 128 - (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0 + (jjP.cameraY / 32), 0, 0, 120, 8, 1);
		jjPalette.gradient(128 + (jjP.cameraY / 32), 64 - (jjP.cameraY / 32), 0, 0 + (jjP.cameraY / 32), 0, 0, 136, 8, 1);
		jjPalette.gradient(192 + (jjP.cameraY / 64), 128 - (jjP.cameraY / 64), 32, 0, 0, 0, 104, 8, 1);
		jjPalette.apply(); // The hues depend on how close to the lava the player is.
		}
	if (jjGameState == GAME::OVERTIME)
		jjMusicLoad("hurry_up.mod"); // Music changes along with overtime.
	if (jjP.yPos > (62.5 * 32) - jjLayerYOffset[2]) {
		jjP.xSpeed = 0;
		jjP.ySpeed = 1;
		}
	jjTexturedBGFadePositionY = 0.55 - (jjP.cameraY / 16384);
	jjPARTICLE@ lavaspecks = jjAddParticle(PARTICLE::SMOKE); // Creates fumes from the lava.
		lavaspecks.xPos = -480 + jjP.xPos + (jjRandom() % 960);
		lavaspecks.yPos = 63*32 - (jjRandom() % 256);
		lavaspecks.ySpeed = -1;
	jjPARTICLE@ raindrops = jjAddParticle(PARTICLE::RAIN); // Water drops from the ceiling.
		raindrops.xPos = -480 + jjP.xPos + (jjRandom() % 960);
		raindrops.yPos = 0 + (jjRandom() % 256);
		raindrops.ySpeed = 5 + (jjRandom() % 5);
	}

void onDrawLayer2(jjPLAYER@ jjP, jjCANVAS@ canvas) {
	jjLayerYOffset[2] = jjSin(jjGameTicks) * 16; // Lava moving up and down.
	}
	
void onDrawLayer7(jjPLAYER@ jjP, jjCANVAS@ screen)
	{
	jjPIXELMAP drawBigHills(0, 0, 6 * 32, 8 * 32, 7);
	jjANIMFRAME@ bigHills = jjAnimFrames[jjAnimations[jjAnimSets[ANIM::SONICPLAT].firstAnim].firstFrame];
	drawBigHills.save(bigHills); // Actually giving the game additional layers!!!
	screen.drawResizedSprite((-5 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((4 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((13 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((22 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((31 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((40 * 32) - ((jjP.cameraX * 0.0625) % (9 * 32)), (-1 * 32) - (jjP.cameraY * 0.015625), ANIM::SONICPLAT, 0, 0, 1.5, 3, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((-5 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((13 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((31 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0);
	screen.drawResizedSprite((49 * 32) - ((jjP.cameraX * 0.1875) % (18 * 32)), (-3.5 * 32) - (jjP.cameraY * 0.0416666666666667), ANIM::SONICPLAT, 0, 0, 3, 6, SPRITE::NORMAL, 0);
	}
Essentially, I'm using Layer 7 as 3 different layers of hills, each with its X Speed and Y Speed, giving the level a total of 10 layers.
And yes, it is way too pixelated, but this is NOT the problem. The actual problem is:
It works fine on Single Player mode, but on Multiplayer, the following problems occur:
- The extra layers work, but are shifted far in the upper left corner (and 2 of their color indexes are incorrect)
- I get the error message "memAlloc() Amnesia error: Out of Memory" after 4 seconds, divided by the amount of players in the game.

And yes, it is important that it works fine on Multiplayer mode, since it's a Battle game.
__________________
Free will was a mistake.
- God

Last edited by DennisKainz; Dec 21, 2015 at 02:30 AM.