Downloads containing AngelWings.asc

Downloads
Name Author Game Mode Rating
Mover Weapons Violet CLM Other 6.5 Download file

File preview

  1. #pragma require "AngelWings.asc"
  2. #include "MLLE-Weapons.asc"
  3. #pragma require "AngelWings.j2a"
  4.  
  5. namespace AngelWings {
  6.         class Weapon : MLLEWeapons::WeaponInterface {
  7.                 uint Halos = 0, HalosPU = 1;
  8.                 float HaloSpeed = 7.5;
  9.                 Weapon() {
  10.                         super(
  11.                                 regularObjectTemplate: MLLEWeapons::ObjectTemplate(
  12.                                         xSpeed: 1,
  13.                                         curAnim: 2,
  14.                                         killAnim: jjAnimSets[ANIM::AMMO] + 4,
  15.                                         playerHandling: HANDLING::PARTICLE,
  16.                                         state: STATE::FLY
  17.                                 ),
  18.                                 animSetFilename: "AngelWings.j2a",
  19.                                 pickupAnimation: 0,
  20.                                 style: WEAPON::CAPPED,
  21.                                 traits: se::weapon_default_traits | se::weapon_increases_mobility,
  22.                                 onPlayer: DetermineLifetime,
  23.                                 behavior: MLLEWeapons::behaviorFunction(StartWings),
  24.                                 apply: MLLEWeapons::applyFunction(CheckHalo)
  25.                         );
  26.                 }
  27.                 bool CheckHalo(uint, se::WeaponHook@, jjSTREAM@ parameters) {
  28.                         if (parameters !is null && parameters.getSize() >= 12) {
  29.                                 uint param;
  30.                                 parameters.pop(param);
  31.                                 Halos = param;
  32.                                 parameters.pop(param);
  33.                                 HalosPU = param;
  34.                                 parameters.pop(param);
  35.                                 HaloSpeed = param / 2.f;
  36.                         }
  37.                         return true;
  38.                 }
  39.                 void StartWings(jjOBJ@ obj, bool powerup) {
  40.                         jjSample(obj.xPos, obj.yPos, SOUND::COMMON_FLAP);
  41.                        
  42.                         uint feathers = 2 + (jjRandom() & (powerup ? 3 : 1));
  43.                         do {
  44.                                 jjOBJ@ feather = jjObjects[jjAddObject(OBJECT::SHARD, obj.xOrg + (int(jjRandom()) & 63) - 32, obj.yOrg, obj.objectID,CREATOR::OBJECT, behavior: Feather)];
  45.                                 feather.curAnim = powerup ? PoweredUpPickupAnimation : PickupAnimation;
  46.                                 feather.ySpeed /= 4;
  47.                                 feather.xSpeed /= 2;
  48.                                 feather.behavior = Feather;
  49.                                 feather.counterEnd = 255;
  50.                                 feather.frameID = jjRandom() & 15;
  51.                         } while (--feathers != 0);
  52.                        
  53.                         uint halos = powerup ? HalosPU : Halos;
  54.                         if (halos != 0) {
  55.                                 int angle = (int(halos) - 1) * -24;
  56.                                 do {
  57.                                         jjOBJ@ halo = jjObjects[jjAddObject(obj.eventID, obj.xPos, obj.yPos, obj.creatorID,obj.creatorType, Halo)];
  58.                                         halo.xSpeed = jjSin(angle) * HaloSpeed;
  59.                                         halo.ySpeed = jjCos(angle) * HaloSpeed;
  60.                                         halo.var[7] = obj.var[7];
  61.                                         if (obj.ySpeed < 0)
  62.                                                 halo.ySpeed = -halo.ySpeed;
  63.                                         angle += 48;
  64.                                 } while (--halos != 0);
  65.                         }
  66.                        
  67.                         if (obj.creatorType == CREATOR::PLAYER) {
  68.                                 const jjPLAYER@ play = jjPlayers[obj.creatorID];
  69.                                 obj.xPos = play.xPos;
  70.                                 obj.yPos = play.yPos + 24;
  71.                                 while (jjMaskedHLine(int(play.xPos) - 12, 24, int(obj.yPos - 36)))
  72.                                         obj.yPos += 1;
  73.                                 if (play.isLocal)
  74.                                         obj.counterEnd = obj.doesHurt;
  75.                         }
  76.                         obj.doesHurt = 0;
  77.                        
  78.                         obj.behavior = Wings;
  79.                 }
  80.         }
  81.         void DetermineLifetime(jjPLAYER@ p, int number) {
  82.                 jjOBJ@ preset = jjObjectPresets[(p.powerup[number] ? se::getPoweredBulletOfWeapon : se::getBasicBulletOfWeapon)(number)];
  83.                 preset.doesHurt = preset.counterEnd = p.fastfire;
  84.         }
  85.         void Wings(jjOBJ@ obj) {
  86.                 if (obj.doesHurt > obj.counterEnd) {
  87.                         obj.clearPlatform();
  88.                         obj.delete();
  89.                 } else {
  90.                         const bool powerup = MLLEWeapons::HelpfulBulletFunctions::IsPowerup(obj);
  91.                         float x,y;
  92.                         if (obj.creatorType == CREATOR::PLAYER) {
  93.                                 const jjPLAYER@ play = jjPlayers[obj.creatorID];
  94.                                 x = play.xPos;
  95.                                 y = play.yPos;
  96.                         } else {
  97.                                 x = obj.xOrg;
  98.                                 y = obj.yOrg;
  99.                         }
  100.                         const jjANIMATION@ anim = jjAnimations[obj.curAnim];
  101.                         const int frameID = obj.doesHurt++ * (anim.frameCount - 1) / (obj.counterEnd + 1) + 1;
  102.                         jjDrawSpriteFromCurFrame(
  103.                                 x,y,
  104.                                 sprite: anim + frameID,
  105.                                 layerZ: frameID == 3 ? 3 : 4,
  106.                                 mode: powerup ? SPRITE::PALSHIFT : SPRITE::NORMAL, param: 8
  107.                         );
  108.                         obj.bePlatform(obj.xPos, obj.yPos);
  109.                 }
  110.         }
  111.         void Feather(jjOBJ@ obj) {
  112.                 if (obj.state != STATE::START) {
  113.                         jjDrawSpriteFromCurFrame(obj.xPos, obj.yPos, obj.curFrame, obj.direction, SPRITE::BLEND_NORMAL, obj.counterEnd);
  114.                         if ((obj.counterEnd -= 4) == 3) {
  115.                                 obj.delete();
  116.                                 return;
  117.                         }
  118.                 }
  119.                 obj.behave(BEHAVIOR::BIRDFEATHER, false);
  120.         }
  121.         void Halo(jjOBJ@ obj) {
  122.                 obj.special = (obj.curAnim -= 1);
  123.                 obj.determineCurFrame();
  124.                 obj.playerHandling = (obj.creatorType == CREATOR::PLAYER) ? HANDLING::PLAYERBULLET : HANDLING::ENEMYBULLET;
  125.                 obj.counterEnd = 35;
  126.                 obj.lightType = LIGHT::POINT2;
  127.                 if (obj.eventID == OBJECT::ICEBULLET) obj.eventID = OBJECT::BLASTERBULLET;
  128.                 obj.behave(obj.behavior = BEHAVIOR::BULLET);
  129.         }
  130. }