1.0
09 Jul 2014 07:45
bool cameraShared = false;
void onMain() {
if (jjLocalPlayerCount == 2) {
jjPLAYER@ player1 = jjLocalPlayers[0];
jjPLAYER@ player2 = jjLocalPlayers[1];
float dx = player1.xPos - player2.xPos;
float dy = player1.yPos - player2.yPos;
if (abs(dx) < jjResolutionWidth && abs(dy) < jjResolutionHeight) { //might want to tweak the distance requirement to make it a little tighter
cameraShared = true;
//nothing to be done about the black line in the middle of the screen...
if (jjGameTicks & 7 == 0) { //a slight delay, causing the scrolling to be more gradual
int lx = int(player1.xPos + player2.xPos - jjResolutionWidth) / 2;
int ty = int(player1.yPos + player2.yPos - jjResolutionHeight) / 2;
if (lx < 0) lx = 0; //should also add a check for the far right side of the level
if (ty < 0) ty = 0; //likewise the bottom
player1.cameraFreeze(lx + player1.subscreenX, ty + player1.subscreenY, false, false);
player2.cameraFreeze(lx + player2.subscreenX, ty + player2.subscreenY, false, false);
}
} else if (cameraShared) {
cameraShared = false;
player1.cameraUnfreeze();
player2.cameraUnfreeze();
}
}
}
Jazz2Online © 1999-INFINITY (Site Credits). We have a Privacy Policy. Jazz Jackrabbit, Jazz Jackrabbit 2, Jazz Jackrabbit Advance and all related trademarks and media are ™ and © Epic Games. Lori Jackrabbit is © Dean Dodrill. J2O development powered by Loops of Fury and Chemical Beats.
Eat your lima beans, Johnny.