Downloads containing lhsoty.j2as

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Star of the year V2Featured Download TreyLina Capture the flag 8.5 Download file

File preview

const bool MLLESetupSuccessful = MLLE::Setup(array<MLLEWeaponApply@> = {null, WeaponVMega::Burrower::Weapon(), ArcaneWeapons::MortarLauncher::Weapon(), null, null, SuperToaster::Weapon(), null, null, WeaponVMega::Meteor::Weapon()}); ///@MLLE-Generated
#include "MLLE-Include-1.6w.asc" ///@MLLE-Generated
#pragma require "lhsoty-MLLE-Data-1.j2l" ///@MLLE-Generated
#pragma require "Aztec2.j2t" ///@MLLE-Generated
#pragma require "lhsoty.j2l" ///@MLLE-Generated
#include "WeaponVMega9.asc" ///@MLLE-Generated
#pragma require "WeaponVMega9.asc" ///@MLLE-Generated
#include "SuperToaster.asc" ///@MLLE-Generated
#pragma require "SuperToaster.asc" ///@MLLE-Generated
#include "ArcaneWeapon4.asc" ///@MLLE-Generated
#pragma require "ArcaneWeapon4.asc" ///@MLLE-Generated
#include "WeaponVMega2.asc" ///@MLLE-Generated
#pragma require "WeaponVMega2.asc" ///@MLLE-Generated
#pragma require "f_ar3.wav"

bool animsLoaded = false;
uint customAnimID = 0;

void onLevelLoad() {
	jjAnimSets[ANIM::CUSTOM[25]].load(0, "Nail.j2a");
	
	jjAnimations[jjAnimSets[ANIM::AMMO] + 62] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 4];
	jjAnimations[jjAnimSets[ANIM::AMMO] + 61] = jjAnimations[jjAnimSets[ANIM::CUSTOM[25]] + 5];
	
	jjSampleLoad(SOUND::P2_CRUNCH, "f_ar3.wav");
	
	jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = Nailgun();
	jjObjectPresets[OBJECT::FIREBALLBULLET].var[6] = 16;
	jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 58;
	jjObjectPresets[OBJECT::FIREBALLBULLET].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
	jjObjectPresets[OBJECT::FIREBALLBULLET].special = jjObjectPresets[OBJECT::FIREBALLBULLET].determineCurAnim(ANIM::CUSTOM[25], 0);
	jjObjectPresets[OBJECT::FIREBALLBULLET].xSpeed = jjObjectPresets[OBJECT::RFBULLETPU].xSpeed;
	jjObjectPresets[OBJECT::FIREBALLBULLET].ySpeed = jjObjectPresets[OBJECT::RFBULLETPU].ySpeed;
	jjObjectPresets[OBJECT::FIREBALLBULLET].xAcc = jjObjectPresets[OBJECT::RFBULLETPU].xAcc;
	jjObjectPresets[OBJECT::FIREBALLBULLET].yAcc = jjObjectPresets[OBJECT::RFBULLETPU].yAcc;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8 + 16;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd = 52;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].killAnim = jjObjectPresets[OBJECT::BLASTERBULLET].killAnim;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].special = jjObjectPresets[OBJECT::FIREBALLBULLETPU].determineCurAnim(ANIM::CUSTOM[25], 1);
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].xSpeed = jjObjectPresets[OBJECT::RFBULLETPU].xSpeed;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].ySpeed = jjObjectPresets[OBJECT::RFBULLETPU].ySpeed;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].xAcc = jjObjectPresets[OBJECT::RFBULLETPU].xAcc;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].yAcc = jjObjectPresets[OBJECT::RFBULLETPU].yAcc;
	jjObjectPresets[OBJECT::FIREBALLBULLET].lightType = jjObjectPresets[OBJECT::FIREBALLBULLETPU].lightType = LIGHT::POINT;
	
	jjObjectPresets[OBJECT::GUN8AMMO3].lightType = LIGHT::POINT;
	
	jjObjectPresets[OBJECT::GUN8POWERUP].determineCurAnim(ANIM::CUSTOM[25], 3);
	jjObjectPresets[OBJECT::GUN8POWERUP].determineCurFrame();
	
	jjWeapons[WEAPON::GUN8].spread = SPREAD::NORMAL;
	jjWeapons[WEAPON::GUN8].style = WEAPON::NORMAL;
	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].defaultSample = false;
	
	jjANIMATION@ anim = jjAnimations[jjAnimSets[ANIM::AMMO] + 71];
	for (uint i = 0; i < anim.frameCount; ++i) {
		jjANIMFRAME@ frame = jjAnimFrames[anim + i];
		jjPIXELMAP sprite(frame);
		for (uint x = 0; x < sprite.width; ++x)
			for (uint y = 0; y < sprite.height; ++y)
			if (sprite[x,y] != 0) sprite[x,y] = 0;
		sprite.save(frame);
	}
	
	if (jjGameMode == GAME::SP) {
		jjLocalPlayers[0].warpToTile(29,28);
	}
}

class Nailgun : jjBEHAVIORINTERFACE {
	bool passedDestScen = false;
	float targetPixelX(jjOBJ@ obj) {
		return obj.xPos + obj.xSpeed + (obj.var[7] / 65536.f);
	}
	float targetPixelY(jjOBJ@ obj) {
		return obj.yPos + obj.ySpeed;
	}

	void onBehave(jjOBJ@ obj) {
		obj.behave(obj.state == STATE::EXPLODE? BEHAVIOR::BULLET : BEHAVIOR::RFBULLET, obj.state == STATE::EXPLODE? true:false);
		jjPLAYER@ creator = jjPlayers[obj.creatorID];
		
		obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
		
		obj.xAcc = (obj.eventID == OBJECT::RFBULLETPU? 0.4:0.35) * obj.direction;
		if (obj.ySpeed < 0 && obj.direction == 0 && obj.xSpeed == 0) obj.yAcc = -0.5;
		  
		
		if (obj.state != STATE::EXPLODE) {
			if (obj.counter == 1 && creator.isLocal) {
				jjSample(creator.xPos, creator.yPos, SOUND::P2_CRUNCH, 48, obj.eventID == OBJECT::RFBULLETPU? 19000:17500);
				obj.var[2] = 0;
				obj.playerHandling = HANDLING::PLAYERBULLET;
			}
			
			jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::CUSTOM[25], obj.eventID == OBJECT::FIREBALLBULLETPU? 1:0, 0, obj.var[0], 1, 1, SPRITE::NORMAL);
			//jjDrawRectangle(targetPixelX(obj), targetPixelY(obj), 8,8, passedDestScen? 24:16, SPRITE::NORMAL);
			
			/*float dx = jjLocalPlayers[0].xPos - obj.xPos, dy = jjLocalPlayers[0].yPos - obj.yPos;
			if ((dx * dx + dy * dy < 64 * 24) && !creator.isLocal && jjLocalPlayers[0].blink == 0 && (jjLocalPlayers[0].team != creator.team || jjFriendlyFire || jjGameMode != GAME::CTF) && gameIsActive()) {
				jjLocalPlayers[0].xPos = obj.xPos - (24 * obj.direction);
				jjLocalPlayers[0].ySpeed = obj.ySpeed;
			}*/
			
			for (int i = 1; i < jjObjectCount; i++) {
				if (jjObjects[i].behavior == BEHAVIOR::DESTRUCTSCENERY && jjObjects[i].xPos >= targetPixelX(obj) - 96 && jjObjects[i].xPos <= targetPixelX(obj) + 96 && jjObjects[i].yPos >= targetPixelY(obj) - 32 && jjObjects[i].yPos <= targetPixelY(obj) + 32) {
					passedDestScen = true;
				}
			}
			
			if (!passedDestScen) {
				if (jjMaskedPixel(int(targetPixelX(obj)), int(obj.yPos))) {
					obj.xSpeed = 0;
					obj.var[7] = 0;
					obj.playerHandling = HANDLING::PARTICLE;
					obj.bePlatform(obj.xPos, obj.yPos, 32, 8);
					if (obj.var[2] == 0) {
						jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
						obj.counter = 1;
						if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
						obj.var[2] = 1;
					}
				}
				else if (jjMaskedPixel(int(obj.xPos), int(targetPixelY(obj)))) {
					obj.ySpeed = 0;
					obj.playerHandling = HANDLING::PARTICLE;
					if (obj.var[2] == 0) {
						jjSample(obj.xPos, obj.yPos, SOUND::COMMON_METALHIT, 0, 0);
						obj.counter = 1;
						if (obj.eventID == OBJECT::RFBULLETPU) obj.counterEnd = 90;
						obj.var[2] = 1;
					}
				}
			} else {
				obj.age++;
				if (obj.age == 7) { 
					passedDestScen = false;
					obj.age = 0;
				}
			}

		} else {
			obj.clearPlatform();
			obj.var[2] = 0;
			obj.counterEnd = obj.eventID == OBJECT::FIREBALLBULLETPU? 75:80;
		}
	}
}

bool onDrawAmmo(jjPLAYER@ player, jjCANVAS@ canvas) {
	return MLLE::WeaponHook.drawAmmo(player, canvas);
}
// && jjEventGet(int(obj.xPos/32), int(obj.yPos/32)) != OBJECT::GENERATOR