Downloads containing weaponVMega8.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Anniversary Bash 26 CTF Jazz2Online Capture the flag N/A Download file
TSF with JJ2+ Only: Anniversary Bash 26 Battle Jazz2Online Battle N/A Download file
TSF with JJ2+ Only: Saline Shores PurpleJazz Capture the flag N/A Download file
TSF with JJ2+ Only: Mt. Gongga Loon Battle N/A Download file
JJ2+ Only: Threed RealmsFeatured Download Violet CLM Single player 9.7 Download file
TSF with JJ2+ Only: Crown of ThornsFeatured Download PurpleJazz Battle 9.2 Download file
JJ2+ Only: violetclm DOM Episodes I...Featured Download Violet CLM Custom / Concept 9 Download file
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

#pragma require "weaponVMega8.asc"
#include "MLLE-Weapons.asc"
#pragma require "weaponVMega.j2a"

namespace WeaponVMega {
	namespace Voranj {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 3.2,
						xAcc: 0.05f,
						age: 2, //number of splits
						lightType: LIGHT::POINT2,
						state: STATE::FLY
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 3.6,
						xAcc: 0.1f,
						age: 3,
						lightType: LIGHT::POINT,
						state: STATE::FLY,
						curAnim: 1
					),
					animSetFilename: "weaponVMega.j2a",
					animSetID: 7,
					pickupAnimation: 2,
					poweredUpPickupAnimation: 3,
					traits: se::weapon_default_traits | se::weapon_fails_in_interiors,
					behavior: function(obj, powerup) { jjSample(obj.xPos, obj.yPos, SOUND::COMMON_RINGGUN); obj.behavior = Behavior; },
					apply: MLLEWeapons::applyFunction(DetermineSplitCount)
				);
			}
			bool DetermineSplitCount(uint, se::WeaponHook@, jjSTREAM@ parameter) {
				if (parameter !is null && parameter.getSize() >= 8) {
					parameter.pop(RegularObjectTemplate.Age);
					parameter.pop(PowerupObjectTemplate.Age);
				}
				return true;
			}
		}
		void Behavior(jjOBJ@ obj) {
			obj.frameID = ++obj.counter / 6;
			if (obj.counter == 6 * 3) {
				obj.state = STATE::EXPLODE;
				if (obj.age > 0) {
					createVoranj(obj, 1);
					createVoranj(obj, -1);
				}
			}
			if (obj.state == STATE::EXPLODE || obj.xPos < 0 || obj.yPos < 0 || MLLEWeapons::HelpfulBulletFunctions::MaskedPixel(obj) || obj.xPos >= MLLEWeapons::LevelRight || obj.yPos >= MLLEWeapons::LevelBottom) {
				obj.counter = 0;
				obj.playerHandling = HANDLING::EXPLOSION;
				obj.behavior = BEHAVIOR::EXPLOSION;
			} else {
				obj.xPos += (obj.xSpeed += obj.xAcc) + obj.var[7] / 65536.f;
				obj.yPos += (obj.ySpeed += obj.yAcc);
				if (obj.var[7] > 0x8000)
					obj.var[7] = obj.var[7] - 0x2000;
				else if (obj.var[7] < -0x8000)
					obj.var[7] = obj.var[7] + 0x2000;
			}
			jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame = jjAnimations[obj.curAnim] + obj.frameID, obj.direction);
		}
		void createVoranj(const jjOBJ@ creator, int direction) {
			const float angle = atan2(creator.ySpeed, creator.xSpeed);
			const float speed = sqrt(creator.xSpeed * creator.xSpeed + creator.ySpeed * creator.ySpeed);
			const float acc = sqrt(creator.xAcc * creator.xAcc + creator.yAcc * creator.yAcc);
			const float angleDifference = direction * 0.78539816339 / 1.5;
			jjOBJ@ obj = jjObjects[jjAddObject(creator.eventID, creator.xPos, creator.yPos, creator.creatorID, creator.creatorType, BEHAVIOR::INACTIVE)];
			obj.xSpeed = cos(angle + angleDifference) * speed;
			obj.ySpeed = sin(angle + angleDifference) * speed;
			obj.xAcc = cos(angle + angleDifference) * acc;
			obj.yAcc = sin(angle + angleDifference) * acc;
			obj.var[3] = creator.var[3];
			obj.var[6] = creator.var[6];
			obj.var[7] = creator.var[7];
			obj.age = creator.age - 1;
			obj.curAnim = creator.curAnim;
			obj.animSpeed = creator.animSpeed;
			obj.playerHandling = creator.playerHandling;
			obj.state = STATE::FLY;
			obj.behavior = Behavior;
		}
	}
}