Downloads containing sanguinespear.mut

Downloads
Name Author Game Mode Rating
JJ2+ Only: Arcane WeaponsFeatured Download PurpleJazz Mutator 10 Download file

File preview

#pragma name "Sanguine Spear"
#pragma require "Syringe.j2a"

void onLevelLoad() {
	jjAnimSets[ANIM::HATTER].load();
	jjAnimSets[ANIM::MONKEY].load();
	jjAnimSets[ANIM::CUSTOM[28]].load(0, "Syringe.j2a");
	
	jjAnimations[jjAnimSets[ANIM::AMMO] + 62] = jjAnimations[jjAnimSets[ANIM::CUSTOM[28]] + 0];
	jjAnimations[jjAnimSets[ANIM::AMMO] + 61] = jjAnimations[jjAnimSets[ANIM::CUSTOM[28]] + 1];
	jjAnimations[jjAnimSets[ANIM::PLUS_COMMON] + 0] = jjAnimations[jjAnimSets[ANIM::CUSTOM[28]] + 3]; //gun 8 crate

	jjObjectPresets[OBJECT::FIREBALLBULLET].behavior = jjObjectPresets[OBJECT::FIREBALLBULLETPU].behavior = BloodSpear();
	jjObjectPresets[OBJECT::FIREBALLBULLET].ySpeed = -1.5;
	jjObjectPresets[OBJECT::FIREBALLBULLET].xSpeed = 8;
	jjObjectPresets[OBJECT::FIREBALLBULLET].counterEnd = 85;
	jjObjectPresets[OBJECT::FIREBALLBULLET].var[6] = 0;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].ySpeed = -2;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].xSpeed = 8.5;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].counterEnd = 95;
	jjObjectPresets[OBJECT::FIREBALLBULLETPU].var[6] = 8;
	
	jjObjectPresets[OBJECT::GUN8POWERUP].determineCurAnim(ANIM::CUSTOM[28], 2, true);
	jjObjectPresets[OBJECT::GUN8POWERUP].determineCurFrame();

	jjWeapons[WEAPON::GUN8].gradualAim = false;
	jjWeapons[WEAPON::GUN8].defaultSample = false;
	jjWeapons[WEAPON::GUN8].replacedByBubbles = true;
}

class BloodSpear : jjBEHAVIORINTERFACE {
	void onBehave(jjOBJ@ obj) {
		obj.behave(BEHAVIOR::BULLET, false);
		obj.var[0] = int(atan2(-obj.ySpeed, obj.xSpeed) * (512.f * 0.318309886142228f));
		
		if (obj.counter == 1 && obj.state == STATE::FLY && jjPlayers[obj.creatorID].isLocal) {
			jjSample(jjPlayers[obj.creatorID].xPos, jjPlayers[obj.creatorID].yPos, SOUND::HATTER_PTOEI, 0, obj.eventID == OBJECT::FIREBALLBULLETPU? 19000:20000);
		}
		
		if (obj.state == STATE::FLY) {
			jjDrawRotatedSprite(obj.xPos, obj.yPos, ANIM::HATTER, 3, jjGameTicks >> 2, obj.var[0], 2, 1, SPRITE::SINGLEHUE, obj.eventID == OBJECT::FIREBALLBULLETPU? 15:24);
			switch (obj.direction) {
				case 1: obj.xSpeed -= 0.1; obj.ySpeed += 0.1; break;
				case -1: obj.xSpeed += 0.1; obj.ySpeed += 0.1; break;
			}
			if (obj.xSpeed == 0) obj.ySpeed += 0.15;
			
			jjPARTICLE@ blood = jjAddParticle(PARTICLE::ICETRAIL);
			blood.xPos = obj.xPos;
			blood.yPos = obj.yPos;
			blood.icetrail.color = obj.eventID == OBJECT::FIREBALLBULLETPU? 16:24;
			blood.icetrail.colorStop = obj.eventID == OBJECT::FIREBALLBULLETPU? 24:32;
		}
		
		if (obj.state == STATE::EXPLODE) {
			jjDrawSprite(obj.xPos, obj.yPos, ANIM::MONKEY, 1, obj.curFrame, obj.direction, SPRITE::SINGLEHUE, obj.eventID == OBJECT::FIREBALLBULLETPU? 15:24);
			if (obj.var[1] < 27) {
				if (obj.var[1] == 1) jjSample(obj.xPos, obj.yPos, SOUND::HATTER_SPLOUT, 0, 20000);
				obj.var[1] = obj.var[1] + 1;
			}
			if (obj.var[1] == 27) {
				obj.var[1] = 0;
				obj.delete();
			}
		}
		
	}
}

void onPlayer(jjPLAYER@ play) {
	float MaxHealth = jjMaxHealth + 1;
	float Health = play.health + 1;
	float healthratio = MaxHealth / Health;

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