Downloads containing weaponVMega5.asc

Downloads
Name Author Game Mode Rating
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

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

namespace WeaponVMega {
	namespace Backfire {
		class Weapon : MLLEWeapons::WeaponInterface {
			Weapon() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 4,
						xAcc: 0.0625f,
						counterEnd: 40,
						lightType: LIGHT::POINT,
						killAnim: 1,
						animSpeed: 3,
						var: array<int> = {0,0,0,0,0,0,2}
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						xSpeed: 4.5,
						xAcc: 0.1875,
						counterEnd: 70/2,
						lightType: LIGHT::POINT2,
						killAnim: 1,
						animSpeed: 2,
						var: array<int> = {0,0,0,0,0,0,2}
					),
					animSetFilename: "weaponVMega.j2a",
					animSetID: 4,
					pickupAnimation: 2,
					poweredUpPickupAnimation: 3,
					spread: SPREAD::RF,
					replacedByBubbles: true,
					traits: se::weapon_default_traits | se::weapon_melts_ice | se::weapon_fails_underwater,
					behavior: function(obj, powerup) { obj.behavior = Behavior; }
				);
			}
		}

		void Behavior(jjOBJ@ obj) {
			if (obj.state == STATE::START) {
				jjOBJ@ spawn = jjObjects[jjAddObject(obj.eventID, obj.xPos, obj.yPos, obj.objectID, CREATOR::OBJECT, BEHAVIOR::INACTIVE)];
				spawn.xSpeed = -obj.xSpeed;
				spawn.ySpeed = -obj.ySpeed;
				spawn.xAcc = -obj.xAcc;
				spawn.yAcc = -obj.yAcc;
				spawn.var[7] = -obj.var[7];
				spawn.counterEnd = obj.counterEnd;
				spawn.creator = obj.creator;
				spawn.curAnim = obj.curAnim;
				spawn.killAnim = obj.killAnim;
				spawn.counterEnd = obj.counterEnd;
				spawn.animSpeed = obj.animSpeed;
				spawn.var[3] = obj.var[3];
				spawn.var[6] = obj.var[6];
				spawn.playerHandling = obj.playerHandling;
				spawn.state = STATE::FLY;
				spawn.behavior = Behavior;
				if (obj.creatorType == CREATOR::PLAYER)
					jjSample(obj.xPos, obj.yPos, SOUND::COMMON_PISTOL1);
			}
			
			const bool dying = obj.state == STATE::EXPLODE;
			obj.behave(BEHAVIOR::BULLET, dying);
			
			if (!dying) {
				if (abs(obj.xSpeed) > abs(obj.ySpeed))
					obj.ySpeed *= 0.95f;
				else
					obj.xSpeed *= 0.95f;
					
				jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, MLLEWeapons::HelpfulBulletFunctions::GetAngle(obj), MLLEWeapons::HelpfulBulletFunctions::GetDirection(obj), 1, SPRITE::SINGLEHUE, !MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj) ? 40 : 32);
			}
		}
	}
}