Downloads containing JC2lvl45.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: RabbitCity 2 P4rr0t Single player 7.7 Download file

File preview

/*************************************************
Created by Parrot86 - RabbitCity 2: The Secret Room
*************************************************/
void onLevelLoad() {
	jjAlert("|||------------> You Got The Red Access Card Key and Boat Key <-------------");
	jjAlert("");
	jjAlert("||Level Name: |Power Station 2 / 2");
	jjAlert("||RabbitCity 2: The Secret Room - Level: |45");
	jjAlert("");
	jjAlert("");

	jjTexturedBGFadePositionY = 1;
	jjUseLayer8Speeds = true;
	
	// Blaster is limited ammo - Thank for zepect!
	jjWeapons[WEAPON::BLASTER].infinite = false;
	jjWeapons[WEAPON::BLASTER].maximum = maxBlaster;
}
//Blaster Reloading - Thank for zepect!
bool pressedR = false;

const int maxBlaster = 15;

void doReload() {
	for(int i = 0; i < jjLocalPlayerCount; i++)
	if(jjLocalPlayers[i].ammo[WEAPON::BLASTER] == 0)
	jjLocalPlayers[i].ammo[WEAPON::BLASTER] = maxBlaster;
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
 if(player.ammo[WEAPON::BLASTER] == 0)
  canvas.drawString(80, jjResolutionHeight - 30, "Press [R] to reload your Blaster!", STRING::MEDIUM, STRING::BOUNCE, 1);
 return false;
}
// Doors - Thank for zepect!
array<bool> keyPressed(256, false); //arrays holds the state of the keys
int myArea = 0;

bool inArea(jjPLAYER@ p, int x1, int y1, int x2, int y2) {
	return ((p.xPos > (x1*32)) && (p.xPos < x2*32 + 32) && (p.yPos > (y1*32)) && (p.yPos < y2*32 + 32));
}
void onKeyDown(jjPLAYER@ p, int key) {
	if(key == 0x26) { //0x26 is up arrow key (all keys at http://msdn.microsoft.com/en-us/library/dd375731(VS.85).aspx)
		if(myArea == 1) p.warpToID(2, true);
		else if(myArea == 2) p.warpToID(1, true);
		else if(myArea == 3) p.warpToID(4, true);
		else if(myArea == 4) p.warpToID(3, true);
		else if(myArea == 5) p.warpToID(6, true);
		else if(myArea == 6) p.warpToID(5, true);
		else if(myArea == 7) p.warpToID(8, true);
		else if(myArea == 8) p.warpToID(7, true);
		else if(myArea == 9) p.warpToID(10, true);
		else if(myArea == 10) p.warpToID(9, true);
		else if(myArea == 11) p.warpToID(12, true);
		else if(myArea == 12) p.warpToID(11, true);
		else if(myArea == 13) p.warpToID(14, true);
		else if(myArea == 14) p.warpToID(13, true);
		else if(myArea == 15) p.warpToID(16, true);
		else if(myArea == 16) p.warpToID(15, true);
		else if(myArea == 17) p.warpToID(18, true);
		else if(myArea == 18) p.warpToID(17, true);
		else if(myArea == 19) p.warpToID(20, true);
		else if(myArea == 20) p.warpToID(19, true);
		else if(myArea == 21) p.warpToID(22, true);
		else if(myArea == 22) p.warpToID(21, true);
	}
}

void onPlayer(jjPLAYER@ p) {
	for(int i = 0; i < 256; i++) { //loop through all the keys
		if(jjKey[i] && !keyPressed[i]) {
			onKeyDown(p, i);
			keyPressed[i] = true;
		} else if(!jjKey[i] && keyPressed[i]) keyPressed[i] = false;
	}
	if(inArea(p, 798, 249, 798, 249)) myArea = 1;
	else if(inArea(p, 969, 12, 969, 12)) myArea = 2;
	else if(inArea(p, 751, 249, 751, 249)) myArea = 3;
	else if(inArea(p, 912, 37, 912, 37)) myArea = 4;
	else if(inArea(p, 726, 249, 726, 249)) myArea = 5;
	else if(inArea(p, 937, 37, 937, 37)) myArea = 6;
	else if(inArea(p, 701, 249, 701, 249)) myArea = 7;
	else if(inArea(p, 962, 37, 962, 37)) myArea = 8;
	else if(inArea(p, 665, 249, 665, 249)) myArea = 9;
	else if(inArea(p, 882, 64, 882, 64)) myArea = 10;
	else if(inArea(p, 579, 249, 579, 249)) myArea = 11;
	else if(inArea(p, 968, 64, 968, 64)) myArea = 12;
	else if(inArea(p, 562, 227, 562, 227)) myArea = 13;
	else if(inArea(p, 952, 86, 952, 86)) myArea = 14;
	else if(inArea(p, 987, 86, 987, 86)) myArea = 15;
	else if(inArea(p, 527, 227, 527, 227)) myArea = 16;
	else if(inArea(p, 369, 227, 369, 227)) myArea = 17;
	else if(inArea(p, 946, 112, 946, 112)) myArea = 18;
	else if(inArea(p, 937, 127, 937, 127)) myArea = 19;
	else if(inArea(p, 378, 242, 378, 242)) myArea = 20;
	else if(inArea(p, 209, 242, 209, 242)) myArea = 21;
	else if(inArea(p, 950, 156, 950, 156)) myArea = 22;
	else myArea = 0;
}

bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {
	if(myArea == 1 || myArea == 2 || myArea == 3 || myArea == 4 || myArea == 5 || myArea == 6 || myArea == 7 || myArea == 8 || myArea == 9 || myArea == 10 || myArea == 11 || myArea == 12 || myArea == 13 || myArea == 14 || myArea == 15 || myArea == 16 || myArea == 17 || myArea == 18 || myArea == 19 || myArea == 20 || myArea == 21 || myArea == 22) {
		canvas.drawString(135, 300, "Press UP to walk through!", STRING::MEDIUM, STRING::BOUNCE, 1);
	}	
	return false;
}
void onMain() {
	if(jjKey[0x52] && !pressedR) {  
	doReload();
	pressedR = true;
	} else if(!jjKey[0x52]) pressedR = false;
  updateGems();
}

void updateGems()
{
  for(int i=1;i<jjObjectCount;i++)
  {
    if(jjObjects[i].isActive)
    {
      if(jjObjects[i].eventID==OBJECT::SUPERGEM)
      {
        jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32,0,2)+1;
      }
      if(jjObjects[i].eventID==OBJECT::FLICKERGEM)
      {
        if(jjEventGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32)==OBJECT::SUPERGEM)
        {
          jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32,0,2)+1;
        }
        else if(jjEventGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32+1)==OBJECT::GEMSTOMP)
        {
          jjObjects[i].var[0]=jjParameterGet(jjObjects[i].xOrg/32,jjObjects[i].yOrg/32+1,0,2)+1;
        }
        if(jjObjects[i].var[0]==2||jjObjects[i].var[0]==3)
        {
          jjObjects[i].points=500*(jjObjects[i].var[0]-1);
        }
      }
    }
  }
}
void onFunction0() { if (p.timerState != TIMER::STARTED) p.timerStart(2*70, false); }
void onFunction1() { p.timerStop(); }
void onPlayerTimerEnd() {
	p.kill();
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| AAAARRGGHHH!");
}
void onFunction2() {
	p.kill();
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| AAAARRGGHHH!");
}
void onFunction3() {
	p.showText("@@@@@@@@#YOU FOUND A SECRET!", STRING::MEDIUM);
}
void onFunction4() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Whoa, water is here!");
}
void onFunction5() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Oh my GOD, this tunnel was destroyed again...");
}
void onFunction6() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| It works on power generators!");
}
void onFunction7() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("*** IT'S UNLOCKED - RED ACCESS CARD ***");
	jjAlert("");
	jjAlert("Player:||||| Yeah!");
}
void onFunction8() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| It's broken");
}
void onFunction9() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Wow... I didn't know this. Low voltage? Hmm");
}
void onFunction10() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Whoa, this is 3 big power generators");
}
void onFunction11() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Hmm, it's huge cesspool, but no water?");
}
void onFunction12() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Yay, water generator, red card and silver key!");
}
void onFunction13() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Nothing here");
}
void onDrawLayer4(jjPLAYER@ p, jjCANVAS@ canvas) {
	canvas.drawString(615*32+8, 226*32-18, "||||Welcome To Power Station",STRING::MEDIUM);
	canvas.drawString(566*32-5, 225*32-18, "||||Welcome To",STRING::SMALL);
	canvas.drawString(565*32+8, 226*32-18, "||||Power Station",STRING::SMALL);
	canvas.drawString(588*32+20, 226*32-18, "||||TICKETS",STRING::SMALL);
	canvas.drawString(514*32, 215*32, "||||A",STRING::MEDIUM);
	canvas.drawString(518*32, 215*32, "||||B",STRING::MEDIUM);
	canvas.drawString(514*32, 205*32, "||||C",STRING::MEDIUM);
	canvas.drawString(518*32, 205*32, "||||D",STRING::MEDIUM);
	canvas.drawString(468*32+20, 221*32-18, "||||Power Station - Stats",STRING::MEDIUM);
	canvas.drawString(470*32, 222*32-15, "|MAX Battery in Power Station",STRING::SMALL);
	canvas.drawString(470*32, 223*32-15, "|High Voltage",STRING::SMALL);
	canvas.drawString(470*32, 224*32-15, "|Power ON in City Island",STRING::SMALL);
	canvas.drawString(470*32, 225*32-15, "|100% Water",STRING::SMALL);
	canvas.drawString(468*32+30, 226*32-15, "|INFO: All Working successfully!",STRING::SMALL);
}
void onDrawLayer3(jjPLAYER@ p, jjCANVAS@ canvas) {
	canvas.drawString(135*32+5, 226*32-18, "||Coca-Cola",STRING::MEDIUM);
}