Advertisement
TheSkipper1995

Untitled

Mar 3rd, 2019
263
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. switch (loopPhase) {
  2.     case 0:
  3.         //first phase of the loop is moving straight forward until loopStartDistance is reached
  4.         loopStartDistance -= abs(xspeed);
  5.         if (abs(xspeedCurrent) < xspeedMax) {
  6.             xspeedCurrent += xAccel*image_xscale;
  7.             xspeed = floor(xspeedCurrent);
  8.         }
  9.            
  10.         if (loopStartDistance <= 0) {
  11.             xspeed = 0;
  12.             loopPhase += 1;
  13.             loopCentrex = x;
  14.             loopCentrey = y-loopRadius;
  15.         }                
  16.         image_index = 0;
  17.         break;
  18.        
  19.     case 1:
  20.         //main phase of the loop, rotate around a centre until diving straight down
  21.         x = round(loopCentrex + (loopRadius * dsin(loopAngleCurrent)));
  22.         y = round(loopCentrey + (loopRadius * dcos(loopAngleCurrent)));
  23.        
  24.         loopAngleMax -= abs(loopAngleIncrement);
  25.         loopAngleCurrent += loopAngleIncrement;
  26.         loopSectionCurrent -= abs(loopAngleIncrement);
  27.        
  28.         if (loopAngleMax <= 0) {
  29.             loopPhase += 1;
  30.             xspeed = 0;
  31.             yspeed = yspeedFall;
  32.         }
  33.        
  34.         //setting animation and rotation during the loop
  35.         if (loopSectionCurrent <= 0) {
  36.             loopSectionCurrent += 45;
  37.             if (image_index == 0) {
  38.                 image_index = 1;
  39.             } else {
  40.                 image_index = 0;
  41.                 image_angle += 90*image_xscale;
  42.             }
  43.         }
  44.         break;
  45.        
  46.     case 2:
  47.         //nose diving towards the ground until collision
  48.         if (instance_exists(global.player)) {
  49.             if (!diveDirectionSet) {
  50.                 if (sign(floor(x) - floor(global.player.x) == image_xscale))
  51.                     diveDirection = image_xscale;
  52.                 diveDirectionSet = true;
  53.             }
  54.         }
  55.         xspeed = diveHomingSpeed * diveDirection;
  56.         image_index = 0;
  57.         image_angle = 270*image_xscale;
  58.        
  59.         //blow up if in contact with the player
  60.         if (instance_place(x,y,global.player))
  61.             script_execute(vfDeath, id);
  62.         break;
  63. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement