Downloads containing ab24btl18.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 24 Battle Jazz2Online Battle N/A Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, null, null, NapsWeapons::HornetGun(), null, null, null, null, null}); ///@MLLE-Generated
#include "MLLE-Include-1.5w.asc" ///@MLLE-Generated
#pragma require "ab24btl18-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "ab24btl18.j2l" ///@MLLE-Generated
#include "hornetgun.asc" ///@MLLE-Generated
#pragma require "hornetgun.asc" ///@MLLE-Generated

#pragma require "NapsMEV0-3-29.asc"
#include "NapsMEV0-3-29.asc"

array<WaspWorkers@> Wasps();
array<array<Waypoint@>> Waypoints();

void onPlayer(jjPLAYER@ play) {
    NapModifier::onPlayerModifierHook(play);
	
	overSeer(play);
}
bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}

/////////////////////////////////////////////////////////

const bool seeWaypoints = false;
bool seeWasps = true;
bool waspsSpawn = false;

void spawnWaypoints() {
	Waypoint(70*32,16*32,0,0);
	Waypoint(18*32,12*32,0,1);
	Waypoint(34*32,11*32,0,2);
	Waypoint(98*32,20*32,0,3,70*3);
	Waypoint(84*32,29*32,0,4);
	Waypoint(95*32,30*32,0,5);
	Waypoint(100*32,40*32,0,6);	
	
	Waypoint(50*32,10*32,1,0);
	Waypoint(45*32,25*32,1,1);
	Waypoint(40*32,30*32,1,2);
	Waypoint(42*32,31*32,1,3);
	Waypoint(24*32,28*32,1,4);
	
	Waypoint(10*32,31*32,2,0);
	Waypoint(16*32,28*32,2,1);
	Waypoint(55*32,38*32,2,2);
	Waypoint(11*32,11*32,2,3);
	
	Waypoint(88*32,40*32,3,0);
	Waypoint(110*32,18*32,3,1);
	Waypoint(100*32,18*32,3,2);
	Waypoint(112*32,7*32,3,3);
	
	Waypoint(60*32,10*32,4,0);
	Waypoint(74*32,2*32,4,1);
	Waypoint(75*32,25*32,4,2);
	
	Waypoint(55*32,47*32,5,0);
	Waypoint(50*32,35*32,5,1);
	Waypoint(75*32,35*32,5,2);
	Waypoint(78*32,50*32,5,3);

	
	
}
void spawnWasps() {
	WaspWorkers(16*32,16*32,0,3,0.1);
	WaspWorkers(20*32,25*32,0,3,0.1);
	WaspWorkers(0*32,40*32,0,3,0.1);
	WaspWorkers(21*32,25*32,0,1,0.1);
	
	WaspWorkers(16*32,10*32,1,3,0.1);
	WaspWorkers(20*32,25*32,1,3,0.1);
	
	WaspWorkers(16*32,10*32,2,3,0.5);
	WaspWorkers(20*32,25*32,2,3,0.1);
	
	WaspWorkers(20*32,25*32,3,3,0.3);
	
	WaspWorkers(75*32,25*32,4,2,0.6);
	
	WaspWorkers(10*32,25*32,5,3,0.1);
	WaspWorkers(22*32,25*32,5,3,0.3);
	WaspWorkers(76*32,25*32,5,2,0.2);
}

////////////////////////////////////////////////////////




void onLevelLoad() {
	init();
	if (seeWasps) {
		spawnWaypoints();
		spawnWasps();
		waspsSpawn = true;
	}
}

void onLevelBegin() {
	if (jjIsServer || jjGameConnection == GAME::LOCAL) {
		jjChat("/n ab24btl19"); //sorry, have to do this for now
	}
}

class Waypoint {
	int ID,position,timer;
	float xPos,yPos;
	Waypoint(){}
	Waypoint(float xPixel, float yPixel,int waypointID,int pos, int wait = 0) {
		this.xPos = xPixel;
		this.yPos = yPixel;
		this.ID = waypointID;
		this.position = pos;
		this.timer = wait;
		if (Waypoints.length() <= uint(waypointID)) {
			Waypoints.resize(waypointID + 1);
		}
		if (Waypoints[waypointID].length() < uint(pos)) {
			Waypoints[waypointID].resize(pos + 1);
		}	
		Waypoints[waypointID].insertAt(pos,@this);
	}
}

void onDrawLayer7(jjPLAYER@ player, jjCANVAS@ canvas) {
	if (seeWasps) {
		for (int i = 0;i < int(Wasps.length());i++) {
			WaspWorkers@ Wasp = Wasps[i];
			Wasp.running(canvas);
		}
	}
	if (seeWaypoints) {
		for (int i = 0;i < int(Waypoints.length());i++) {
			for (int j = 0;j < int(Waypoints[i].length());j++) {
				Waypoint@ WP = Waypoints[i][j];
				jjDrawString(WP.xPos,WP.yPos,"| " + i + "| " + j,STRING::SMALL,STRING::NORMAL,0,0,8);
			}
		}
	}
}

class WaspWorkers {
	float xPos,yPos,xSpeed,ySpeed,maxSpeed,acc,timerWait;
	int waypointLine;
	int waypoint = -1;
	WaspWorkers(){}
	WaspWorkers(float xPixel,float yPixel,int waypointID,float maxspeed,float speed = 4) {
		this.xPos = xPixel;
		this.yPos = yPixel;
		this.maxSpeed = maxspeed;
		this.waypointLine = waypointID;
		this.acc = speed;
		Wasps.insertLast(@this);
	}
	void running(jjCANVAS@ canvas) {
		float targetXPos = 0;
		float targetYPos = 0;
		if (this.waypoint < int(Waypoints[waypointLine].length() - 1)) {
			targetXPos = Waypoints[waypointLine][waypoint + 1].xPos;
			targetYPos = Waypoints[waypointLine][waypoint + 1].yPos;
		} else {
			targetXPos = Waypoints[waypointLine][0].xPos;
			targetYPos = Waypoints[waypointLine][0].yPos;
		}
			
		if (this.xPos > targetXPos - 32*2 && this.xPos < targetXPos + 32*2 && this.yPos > targetYPos - 32*2 && this.yPos < targetYPos + 32*2 && (jjRandom() % 10 == 0)) {
			if (timerWait > 0) {
				timerWait--;
			} else {
				if (this.waypoint < int(Waypoints[waypointLine].length()) - 2) {
					this.waypoint += 1;
					this.timerWait = Waypoints[waypointLine][waypoint + 1].timer;
				} else {
					this.waypoint = -1;
					this.timerWait = Waypoints[waypointLine][0].timer;
				}
			}
		}
		const float PI = 3.1415927f;
		int destination = int(atan2(targetYPos - this.yPos , targetXPos - this.xPos)  * (512 / PI));
		this.xSpeed += acc * jjCos(destination);
		this.ySpeed += acc * jjSin(destination);
		if (this.xSpeed > this.maxSpeed) {
			this.xSpeed = this.maxSpeed;
		}
		if (this.xSpeed < -this.maxSpeed) {
			this.xSpeed = -this.maxSpeed;
		}
		if (this.ySpeed > this.maxSpeed) {
			this.ySpeed = this.maxSpeed;
		}
		if (this.ySpeed < -this.maxSpeed) {
			this.ySpeed = -this.maxSpeed;
		}
		this.xPos += this.xSpeed;
		this.yPos += this.ySpeed;
		uint curFrame = jjObjectPresets[OBJECT::SEEKERBULLET].curFrame + ((jjGameTicks % 63)/7);
		canvas.drawSpriteFromCurFrame(int(xPos),int(yPos),curFrame,xSpeed >= 0? 1 : -1,SPRITE::TINTED);
	}
}

int gamesWithPowerup = 0;
int powerupGained = 0;

void overSeer(jjPLAYER@ play) {
	if (powerupGained == gamesWithPowerup) {
		if (play.powerup[4]) {
			powerupGained++;
			jjSTREAM interestingBehavior;
			interestingBehavior.push(powerupGained);
			interestingBehavior.save("blghoneyData");
		}
	}
}
bool onLocalChat(string &in text, CHAT::Type type) {
	if (jjRegexMatch(text, "!wasp", true)) {
		if (seeWasps == true) {
			seeWasps = false;
			jjConsole("|||You have ||||||disabled|| wasps");
		}
		else {
			seeWasps = true;
			jjConsole("|||You have |||||enabled||| wasps");
			if (waspsSpawn == false) {
				spawnWaypoints();
				spawnWasps();
				waspsSpawn = true;
			}
		}
		jjSTREAM wasp;
		wasp.push(seeWasps);
		wasp.save("blghoney.asdat");
		return true;
	}
	else return false;
}
void init() {
	jjSTREAM settings("blghoney.asdat");
	if (settings.isEmpty() == false) {
		settings.pop(seeWasps);
	}
	jjConsole("|||Wasps are currently " + (seeWasps? "|||||Enabled|||" : "||||||Disabled||") + ", type |||||||!wasp| to " + (seeWasps? "disable" : "enable") + " them");
	jjSTREAM interesting("blghoneyData.asdat");
	if (interesting.isEmpty() == false) {
		interesting.pop(gamesWithPowerup);
		powerupGained = gamesWithPowerup;
	}
}