Downloads containing JC2lvl59.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("||Level Name: |First Police Station 1 / 4");
	jjAlert("||RabbitCity 2: The Secret Room - Level: |59");
	jjAlert("");
	jjAlert("");

	jjTexturedBGFadePositionY = 1;
	
	// 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(3, true);
		else if(myArea == 2) p.warpToID(4, true);
		else if(myArea == 5) p.warpToID(6, true);
		else if(myArea == 6) p.warpToID(5, 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, 7, 7, 7, 7)) myArea = 1;
	else if(inArea(p, 214, 84, 214, 84)) myArea = 2;
	else if(inArea(p, 146, 40, 146, 40)) myArea = 5;
	else if(inArea(p, 21, 84, 21, 84)) myArea = 6;
	else myArea = 0;
}

bool onDrawHealth(jjPLAYER@ player, jjCANVAS@ canvas) {
	if(myArea == 1 || myArea == 2 || myArea == 5 || myArea == 6) {
		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 onFunction1() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** NOTICE:  RESTRICTED AREA ***");
	jjAlert("This area is under 24hour video surveillance");
	jjAlert("|*** WARNING!  NO GUNS ALLOWED ***");
	jjAlert("");
}
void onFunction2() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** NO ENTRY ***");
	jjAlert("");
	jjAlert("");
}
void onFunction3() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("*** IT'S UNLOCKED - ID ACCESS CARD ***");
	jjAlert("");
	jjAlert("Player:||||| What the hell?");
}
void onFunction4() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Whoooaaaa... this police station was destroyed? Damn!");
}
void onFunction5() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("Player:||||| Uh? I found a two SWAT is alive?");
}
void onFunction6() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("SWAT:||||| Stop it! Get drop of your blaster or kill you!");
	jjAlert("Player:||||| Why?");
}
void onFunction7() {
	p.kill();
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** KILLED BY SWAT ***");
	jjAlert("");
	jjAlert("");
	jjAlert("SWAT:||||| You are Player Wanted! I will kill you!");
	jjAlert("Player:||||| AUGH!");
}
void onFunction8() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** IT'S LOCKED ***");
	jjAlert("");
	jjAlert("Player:||||| WOW! it's broken...");
}
void onFunction9() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** IT'S LOCKED ***");
	jjAlert("");
	jjAlert("Player:||||| It's broken!");
}
void onFunction10() {
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("");
	jjAlert("|*** IT'S LOCKED ***");
	jjAlert("");
	jjAlert("Player:||||| It's broken!");
}
void onFunction11() {
	jjAlert("");
	jjAlert("Player:||||| Are you alive?");
	jjAlert("???:||||| Uh oh Player Wanted!");
	jjAlert("Player:||||| Please stop it, but who are you?");
	jjAlert("Miffy:||||| Hmm, I am Miffy, but I'm scared");
	jjAlert("Player:||||| OK, where is heliport?");
	jjAlert("Miffy:||||| Go to elevator with 3 floor");
	jjAlert("Player:||||| Thanks!");
}
void onDrawLayer4(jjPLAYER@ p, jjCANVAS@ canvas) {
	canvas.drawString(212*32, 82*32-16, "|-GreenSpaz-",STRING::SMALL);
	canvas.drawString(277*32, 92*32-16, "||DANGER",STRING::MEDIUM);
	canvas.drawString(290*32+10, 91*32-16, "|OFFICE",STRING::MEDIUM);
	canvas.drawString(168*32+10, 7*32-16, "|Exit",STRING::SMALL);
}
void onDrawLayer5(jjPLAYER@ p, jjCANVAS@ canvas) {
	canvas.drawString(207*32, 92*32-16, "||DANGER",STRING::MEDIUM);
}