Downloads containing ElektrekShield.asc

Downloads
Name Author Game Mode Rating
TSF with JJ2+ Only: A Titan, Ornery cooba Battle N/A Download file
Custom Weapons...Featured Download Violet CLM Other 10 Download file

File preview

#pragma require "ElektrekShield.asc"
#include "MLLE-Weapons.asc"
#pragma require "SmokeWopens.j2a"

namespace SmokeWopens {
	namespace ElektrekShield {
		class Wopen : MLLEWeapons::WeaponInterface {
			Wopen() {
				super(
					regularObjectTemplate: MLLEWeapons::ObjectTemplate(
						animSpeed: 1,
						curAnim: 1,
						playerHandling: HANDLING::PARTICLE,
						counterEnd: 40
					),
					powerupObjectTemplate: MLLEWeapons::ObjectTemplate(
						animSpeed: 1,
						curAnim: 2,
						playerHandling: HANDLING::PARTICLE,
						counterEnd: 60
					),
					animSetFilename: "SmokeWopens.j2a",
					pickupAnimation: 0,
					style: WEAPON::CAPPED,
					traits: se::weapon_default_traits | se::weapon_goes_through_thin_walls,
					behavior: function(obj, powerup) {
						DefaultWeapons::DefaultSample(obj, WEAPON::ICE);
						int i, shift;
						if (!powerup) {
							i = 8; shift = 7;
						} else {
							i = 16; shift = 6;
						}
						while (i-- != 0) {
							jjOBJ@ shield = jjObjects[jjAddObject(obj.eventID, obj.xPos,obj.yPos, obj.creatorID, obj.creatorType, Behavior)];
							shield.counter = i << shift;
							shield.curFrame = obj.curFrame;
							shield.counterEnd = obj.counterEnd;
							shield.age = 7 - shift;
							shield.lightType = LIGHT::POINT2;
							shield.playerHandling = obj.creatorType == CREATOR::PLAYER ? HANDLING::PLAYERBULLET : HANDLING::ENEMYBULLET;
						}
						obj.delete();
					}
				);
			}
		}
		
		void Behavior(jjOBJ@ obj) {
			if (obj.state == STATE::START) {
				obj.state = STATE::FLY;
				obj.xPos = obj.yPos = -40;
			} else if (--obj.counterEnd == 0 || obj.state == STATE::EXPLODE) {
				obj.delete();
			} else {
				const auto xOrg = (obj.creatorType == CREATOR::PLAYER) ? jjPlayers[obj.creatorID].xPos : obj.creatorID != 0 ? jjObjects[obj.creatorID].xPos : obj.xOrg;
				const auto yOrg = (obj.creatorType == CREATOR::PLAYER) ? jjPlayers[obj.creatorID].yPos : obj.creatorID != 0 ? jjObjects[obj.creatorID].yPos : obj.yOrg;
				obj.counter += ((obj.creatorType == CREATOR::PLAYER) ? jjPlayers[obj.creatorID].direction : 1) * 20;
				if (obj.age != 0) ++obj.age;
				
				const int radius = 70 + obj.age;
				obj.xPos = xOrg + jjSin(obj.counter) * radius;
				obj.yPos = yOrg + jjCos(obj.counter) * radius;
				jjDrawRotatedSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame + ((jjGameTicks >> 1) & 1), obj.counter);
				
				/*for (uint otherObjectID = jjObjectCount; --otherObjectID != 0;) {
					jjOBJ@ other = jjObjects[otherObjectID];
					if (other.isActive && other.creator != obj.creator && (other.playerHandling == HANDLING::PLAYERBULLET || other.playerHandling == HANDLING::ENEMYBULLET) && other.state != STATE::EXPLODE && obj.doesCollide(other, true))
						other.state = STATE::EXPLODE;
				}*/
			}
		}
	}
}