Downloads containing ArcaneWeapon2.asc

Downloads
Name Author Game Mode Rating
JJ2+ Only: Knapweed Bog Lark Battle N/A Download file
JJ2+ Only: Anniversary Bash 25 CTF Jazz2Online Capture the flag N/A Download file
TSF with JJ2+ Only: Western WildernessFeatured Download Dragusela Capture the flag 9.2 Download file
TSF with JJ2+ Only: Moon BaseFeatured Download Dragusela Capture the flag 9 Download file
TSF with JJ2+ Only: Anniversary Bash 24 Battle Jazz2Online Battle N/A Download file
TSF with JJ2+ Only: BioMess Rysice Battle N/A Download file
TSF with JJ2+ Only: Lori FortressFeatured Download Primpy Single player 8.7 Download file
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

#pragma require "ArcaneWeapon2.asc"
#include "MLLE-Weapons.asc"
#pragma require "Meteor.j2a"
#pragma offer "expmine.wav"

namespace ArcaneWeapons {
	namespace MeteorGun {
		SOUND::Sample FireSound = SOUND::COMMON_LAND1;
		class Weapon : MLLEWeapons::WeaponInterface {
			bool LittleRocksNormal = true, LittleRocksPowerup = true;
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 5,
						xAcc: 0.15,
						yAcc: 0.2415527344f,
						special: -1,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 4,
						lightType: LIGHT::POINT,
						light: 10,
						curAnim: 1,
						counterEnd: (70*3)/2
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 5,
						xAcc: 0.1,
						yAcc: 0.2915527344f,
						special: -1,
						killAnim: jjAnimSets[ANIM::AMMO].firstAnim + 5,
						lightType: LIGHT::BRIGHT,
						light: 10,
						curAnim: 0,
						counterEnd: (70*3)/2,
						animSpeed: 2
					),
					animSetFilename: "Meteor.j2a",
					pickupAnimation: 2,
					poweredUpPickupAnimation: 1,
					ammoCrateAnimation: 3,
					powerupAnimation: 4,
					sampleFilenames: array<string> = {"expmine.wav"},
					style: WEAPON::MISSILE,
					behavior: MLLEWeapons::behaviorFunction(DetermineBehavior),
					apply: MLLEWeapons::applyFunction(DetermineLittleRocks),
					onMain: ResizeSparks
				);
			}
		
			bool DetermineLittleRocks(uint, se::WeaponHook@, jjSTREAM@ parameter) {
				if (SamplesLoaded[0]) FireSound = Samples[0];
				if (parameter !is null && parameter.getSize() >= 2) {
					parameter.pop(LittleRocksNormal);
					parameter.pop(LittleRocksPowerup);
				}
				return true;
			}
			void DetermineBehavior(jjOBJ@ obj, bool powerup) {
				if (obj.eventID == OBJECT::ICEBULLET)
					obj.eventID = OBJECT::BLASTERBULLET;
				if (abs(obj.ySpeed) > abs(obj.xSpeed))
					obj.yAcc += 0.4;
				if (!(powerup ? LittleRocksPowerup : LittleRocksNormal))
					obj.var[2] = 1;
				obj.behavior = jjVOIDFUNCOBJ(Behavior);
			}
			void Behavior(jjOBJ@ obj) const {
				obj.behave(BEHAVIOR::BULLET, obj.state == STATE::EXPLODE);
				const bool powerup = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj);
				
				if (obj.state != STATE::EXPLODE) {
					if (obj.counter == 1 && obj.creatorType == CREATOR::PLAYER) {
						const jjPLAYER@ creator = jjPlayers[obj.creatorID];
						if (creator.isLocal) {
							jjSample(creator.xPos, creator.yPos, FireSound, 42, !powerup ? 22000 : 20000);
						}
					}
					obj.age += obj.direction == 0 ? 10 : 10 * obj.direction;
					
					jjDrawRotatedSprite(obj.xPos, obj.yPos, SetID, !powerup? 1:0, 0, -obj.age, 1, 1, !powerup || obj.var[4] == 1? SPRITE::SINGLEHUE : SPRITE::NORMAL, 72);
					
					if (powerup && obj.var[4] == 0) {
						jjDrawRotatedSprite(obj.xPos, obj.yPos, SetID, 0, 0, -obj.age, 1, 1, SPRITE::TRANSLUCENTSINGLEHUE, 40);
						jjPARTICLE@ cinders = jjAddParticle(PARTICLE::FIRE);
						if (cinders !is null) {
							cinders.xPos = int(obj.xPos - 8) + jjRandom()%17;
							cinders.yPos = int(obj.yPos - 8) + jjRandom()%17;
						}
					}
					
					if (obj.yPos > jjWaterLevel) {
						obj.var[4] = 1;
						obj.xSpeed *= 0.875;
						obj.ySpeed *= 0.875;
					}
					
					if (obj.ySpeed > 8) obj.ySpeed = 8;
				} else {
					obj.age = 0;
					if (obj.var[2] == 0) {
						jjSample(obj.xPos, obj.yPos, SOUND::COMMON_BENZIN1, 0, 0);
						obj.var[2] = 1;
						
						for (int i = -1; i <= 1; i+= 2) {
							jjOBJ@ rock = jjObjects[jjAddObject(OBJECT::SHARD, int(obj.xPos + (i * 12)), int(obj.yPos - 8), obj.creatorID, CREATOR::PLAYER, Rock)];
							rock.determineCurAnim(SetID, powerup ? 0 : 1);
							rock.playerHandling = obj.creatorType == CREATOR::PLAYER ? HANDLING::PLAYERBULLET : HANDLING::ENEMYBULLET;
							rock.var[3] = obj.var[3];
							rock.var[4] = obj.var[4];
							rock.var[6] = obj.var[6];
							rock.animSpeed = obj.animSpeed;
							rock.special = powerup? 40:72;
							rock.direction = i;
							rock.xSpeed = 6 * i;
							rock.ySpeed = -3;
							rock.state = STATE::FLY;
							rock.lightType = LIGHT::POINT;
							rock.light = 10;
							rock.counterEnd = (70*3)/2;
							rock.killAnim = jjAnimSets[ANIM::AMMO].firstAnim + 4;
						}
					}
				}
			}
		}

		void Rock(jjOBJ@ obj) {
			obj.behave(BEHAVIOR::BULLET, obj.state == STATE::EXPLODE);
			
			if (obj.state == STATE::FLY) {
				obj.age += obj.direction == 0? 10 : 10 * obj.direction;
				jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, -obj.age, 0.5,0.5, SPRITE::SINGLEHUE, obj.special);
				
				switch (obj.direction) {
					case 1: obj.xSpeed -= 0.05; obj.ySpeed += 0.1; break;
					case -1: obj.xSpeed += 0.05; obj.ySpeed += 0.1; break;
				}
				
				if (obj.yPos > jjWaterLevel) {
					obj.var[4] = 1;
					obj.xSpeed = obj.xSpeed * 0.875;
					obj.ySpeed = obj.ySpeed * 0.875;
				}
			}
		}
		
		void ResizeSparks(int) {
			for (int i = 0; i < 1024; i++) {
				jjPARTICLE@ particle = jjParticles[i];
				if (particle.type == PARTICLE::FIRE)
					particle.fire.size = particle.fire.color == 40? 3:2;
			}
		}
	}
}