Downloads containing ArcaneWeapon3.asc

Downloads
Name Author Game Mode Rating
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 "ArcaneWeapon3.asc"
#include "MLLE-Weapons.asc"
#pragma require "CosmicDust.j2a"
#pragma offer "lowind.wav"

namespace ArcaneWeapons {
	namespace CosmicDuster {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 1,	//needed for direction
						xAcc: 1,	//
						curAnim: 1,
						lightType: LIGHT::BRIGHT,
						light: 8,
						counterEnd: 180,
						freeze: 200,
						state: STATE::SLEEP,
						var: array<int> = {120, 72, 60}
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 1,
						xAcc: 1,
						lightType: LIGHT::BRIGHT,
						light: 12,
						counterEnd: 180,
						freeze: 254,
						state: STATE::SLEEP,
						var: array<int> = {160, 34, 80}
					),
					animSetFilename: "CosmicDust.j2a",
					pickupAnimation: 2,
					poweredUpPickupAnimation: 1,
					ammoCrateAnimation: 3,
					powerupAnimation: 4,
					style: WEAPON::POPCORN,
					multiplier: 16,
					traits: se::weapon_is_effective_against_all_targets | se::weapon_supports_mouse_aim | se::weapon_works_in_all_modes | se::weapon_has_all_pickups | se::weapon_inflicts_status_condition | se::weapon_freezes_objects | se::weapon_melts_ice,
					apply: MLLEWeapons::applyFunction(LoadCustomFireSound),
					behavior: function(obj, powerup) { if (obj.direction == 0) obj.direction = 1; obj.behavior = Behavior; }
				);
			}
			uint getMaxDamage(bool powerup) const override { return 0; }
			bool LoadCustomFireSound(uint, se::WeaponHook@, jjSTREAM@ parameter) {
				if (parameter !is null && !parameter.isEmpty()) {
					bool customFireSound;
					parameter.pop(customFireSound);
					if (!customFireSound)
						return true;
				} //else continue, loading the sound by default if no parameter is provided
				jjSampleLoad(SOUND::COMMON_FLAMER, "lowind.wav");
				return true;
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			if (obj.state != STATE::EXPLODE && ++obj.counter < int(obj.counterEnd)) {
				float xOrg, yOrg;
				if (obj.creatorType == CREATOR::PLAYER) {
					jjPLAYER@ creator = jjPlayers[obj.creatorID];
					xOrg = creator.xPos; yOrg = creator.yPos;
				} else {
					jjOBJ@ creator = jjObjects[obj.creatorID];
					if (creator.isActive) {
						xOrg = creator.xPos; yOrg = creator.yPos;
					} else {
						xOrg = obj.xOrg; yOrg = obj.yOrg;
					}
				}
				
				obj.var[4] = obj.var[4] - (5 * obj.direction);
						
				obj.xPos = xOrg + obj.var[0]*jjSin(obj.counter*12) * obj.direction;
				obj.yPos = yOrg - obj.var[2]*jjCos(obj.counter*12);
				
				for (int i = 0; i < 2; ++i)
					jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.var[4], 1, 1, SPRITE::ALPHAMAP, obj.var[1]);
			} else {
				obj.delete();
			}
		}
	}
}