Downloads containing ArcaneWeapon8.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: Laboratory 38Featured Download Dragusela Battle 8 Download file
TSF with JJ2+ Only: Lori FortressFeatured Download Primpy Single player 8.7 Download file
TSF with JJ2+ Only: Anniversary Bash 23 levels Jazz2Online Multiple N/A Download file
TSF with JJ2+ Only: SalemFeatured Download Loon Battle 9 Download file
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

#pragma require "ArcaneWeapon8.asc"
#include "MLLE-Weapons.asc"
#pragma require "Syringe.j2a"

namespace ArcaneWeapons {
	namespace SanguineSpear {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 8,
						xAcc: 0.025,
						ySpeed: -1.5,
						yAcc: 0.1,
						animSpeed: 1,
						curAnim: jjObjects[0].determineCurAnim(ANIM::HATTER, 3, false),
						killAnim: jjObjects[0].determineCurAnim(ANIM::MONKEY, 1, false),
						lightType: LIGHT::POINT2,
						counterEnd: 85,
						doesHurt: 24
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 8.5,
						xAcc: 0.025,
						ySpeed: -2,
						yAcc: 0.1,
						animSpeed: 2,
						curAnim: jjObjects[0].determineCurAnim(ANIM::HATTER, 3, false),
						killAnim: jjObjects[0].determineCurAnim(ANIM::MONKEY, 1, false),
						lightType: LIGHT::POINT,
						counterEnd: 95,
						doesHurt: 16
					),
					animSetFilename: "Syringe.j2a",
					pickupAnimation: 0,
					poweredUpPickupAnimation: 1,
					ammoCrateAnimation: 3,
					powerupAnimation: 2,
					replacedByBubbles: true,
					onPlayerInput: determineSpread,
					behavior: function(obj, powerup) {
						if (obj.creatorType == CREATOR::PLAYER && jjPlayers[obj.creatorID].isLocal)
							jjSample(obj.xPos, obj.yPos, SOUND::HATTER_PTOEI, 0, powerup? 19000:20000);
						if (obj.eventID == OBJECT::ICEBULLET)
							obj.eventID = OBJECT::BLASTERBULLET;
						if (abs(obj.ySpeed) > abs(obj.xSpeed))
							obj.yAcc += 0.15;
						obj.behavior = Behavior;
					}
				);
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			obj.behave(BEHAVIOR::BULLET, false);
			const bool powerup = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj);
			
			if (obj.state == STATE::FLY) {
				jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, MLLEWeapons::HelpfulBulletFunctions::GetAngle(obj), MLLEWeapons::HelpfulBulletFunctions::GetDirection(obj) * 2, 1, SPRITE::SINGLEHUE, obj.doesHurt);
				
				jjPARTICLE@ blood = jjAddParticle(PARTICLE::ICETRAIL);
				if (blood !is null) {
					blood.xPos = obj.xPos;
					blood.yPos = obj.yPos;
					blood.icetrail.color = obj.doesHurt;
					blood.icetrail.colorStop = obj.doesHurt+8;
				}
			}
			
			if (obj.state == STATE::EXPLODE) {
				jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, obj.doesHurt);
				if (obj.age < 27) {
					if (obj.age == 1) jjSample(obj.xPos, obj.yPos, SOUND::HATTER_SPLOUT, 0, 20000);
					obj.age = obj.age + 1;
				}
				if (obj.age == 27) {
					obj.age = 0;
					obj.delete();
				}
			}
		}
		
		void determineSpread(jjPLAYER@ play, int number) {
			const float MaxHealth = jjMaxHealth + 1;
			const float Health = play.health + 1;
			const float healthratio = MaxHealth / Health;

			if (healthratio < 1.3) jjWeapons[number].spread = SPREAD::NORMAL;
			else if (healthratio >= 1.3 && healthratio < 2) jjWeapons[number].spread = SPREAD::RFNORMAL;
			else if (healthratio >= 2) jjWeapons[number].spread = SPREAD::RFPU;
		}
	}
}