Downloads containing xlmexpress.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 18 Levels Jazz2Online Multiple N/A Download file
JJ2+ Only: Electric ExpressFeatured Download PurpleJazz Multiple 9.3 Download file

File preview

// Electric Express
// Created by PurpleJazz of XLM (2010-2015)

/*******************************************************************/

uint elapsed = 0;
array<bool> electrocution(4, false);

void onLevelLoad() {
	jjTexturedBGTexture = TEXTURE::MEDIVO;

	jjObjectPresets[OBJECT::PLASMASHIELDBULLET].counterEnd = 0; //only the particle effect required
	jjObjectPresets[OBJECT::PLASMASHIELDBULLET].playerHandling = HANDLING::PARTICLE;
	
	jjWeapons[WEAPON::SEEKER].comesFromGunCrates = false;

	jjWeapons[WEAPON::GUN8].comesFromGunCrates = 
	jjWeapons[WEAPON::GUN9].comesFromGunCrates = true;
	
	jjUseLayer8Speeds = true;
}

const array<string> DeathMessages = {
	" got electrocuted",
	" completed the circuit",
	" was fried",
	" received 10,000 volts",
	" met the thunder god", 
	" came to a shocking conclusion",
	" became welded to the overhead wire"
};

void onReceive(jjSTREAM &in packet, int clientID) {
	if (jjIsServer) {
		int a;
		packet.pop(a);
		jjPlayers[a].yPos > 14*32?
			jjAlert("" + jjPlayers[a].name + " fell off the train", true) :
			jjAlert("" + jjPlayers[a].name + DeathMessages[jjRandom()%7], true);					
	}
}

void onPlayer(jjPLAYER@ play) {
	if (jjEventGet(int(play.xPos/32), int((play.yPos/32)+0.5)) == AREA::REVERTMORPH && play.health > 0) {
		electrocution[play.localPlayerID] = true;
	}
	if (electrocution[play.localPlayerID]) {
		elapsed++;

		play.xSpeed = -8; // the train is moving afterall
		play.ySpeed = 0;

		if (play.yPos > 14*32) { // hold still, damn it
			play.yPos = (51*32)-24;
		} else {
			play.yPos = (13*32)-24;
		}
	
		if (elapsed % 7 == 0) {
			play.hurt(0, true);
			jjAddObject(OBJECT::PLASMASHIELDBULLET, play.xPos, play.yPos, 0, CREATOR::OBJECT, BEHAVIOR::DEFAULT); //shocking!
		}

		if (elapsed >= 140) {
			elapsed = 0;
			electrocution[play.localPlayerID] = false;
			play.kill(); // Die;
			if (jjIsServer) {
				play.yPos > 14*32?
					jjAlert("" + play.name + " fell off the train", true) :
					jjAlert("" + play.name + DeathMessages[jjRandom()%7], true);	
			}
			else {
				jjSTREAM packet;
				packet.push(play.clientID);
				jjSendPacket(packet);
			}
		}
	}

	for (int i = 1; i < jjObjectCount; i++) {
		if ((jjObjects[i].eventID == OBJECT::GOLDCOIN || jjObjects[i].eventID == OBJECT::SILVERCOIN) && jjObjects[i].state == STATE::FLOATFALL) {
			jjObjects[i].state = STATE::FLOAT; // can’t shoot the coins down
		}
		if (jjObjects[i].eventID == OBJECT::BOUNCERPOWERUP) {
			jjObjects[i].yPos = 49.8*32;
			jjObjects[i].ySpeed = 0;
		}
	}

	jjTriggers[1] = play.yPos > 49*32? true : false;
}

void onFunction0(jjPLAYER@ play) {
	play.showText("@@@@Electric Express@Created by PurpleJazz of XLM (2010-2015)@Tileset conversion by NOKA, P4ul and cooba@np: CoreTex - Home [6:10]");
}