Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- switch (loopPhase) {
- case 0:
- //first phase of the loop is moving straight forward until loopStartDistance is reached
- loopStartDistance -= abs(xspeed);
- if (abs(xspeedCurrent) < xspeedMax) {
- xspeedCurrent += xAccel*image_xscale;
- xspeed = floor(xspeedCurrent);
- }
- if (loopStartDistance <= 0) {
- xspeed = 0;
- loopPhase += 1;
- loopCentrex = x;
- loopCentrey = y-loopRadius;
- }
- image_index = 0;
- break;
- case 1:
- //main phase of the loop, rotate around a centre until diving straight down
- x = round(loopCentrex + (loopRadius * dsin(loopAngleCurrent)));
- y = round(loopCentrey + (loopRadius * dcos(loopAngleCurrent)));
- loopAngleMax -= abs(loopAngleIncrement);
- loopAngleCurrent += loopAngleIncrement;
- loopSectionCurrent -= abs(loopAngleIncrement);
- if (loopAngleMax <= 0) {
- loopPhase += 1;
- xspeed = 0;
- yspeed = yspeedFall;
- }
- //setting animation and rotation during the loop
- if (loopSectionCurrent <= 0) {
- loopSectionCurrent += 45;
- if (image_index == 0) {
- image_index = 1;
- } else {
- image_index = 0;
- image_angle += 90*image_xscale;
- }
- }
- break;
- case 2:
- //nose diving towards the ground until collision
- if (instance_exists(global.player)) {
- if (!diveDirectionSet) {
- if (sign(floor(x) - floor(global.player.x) == image_xscale))
- diveDirection = image_xscale;
- diveDirectionSet = true;
- }
- }
- xspeed = diveHomingSpeed * diveDirection;
- image_index = 0;
- image_angle = 270*image_xscale;
- //blow up if in contact with the player
- if (instance_place(x,y,global.player))
- script_execute(vfDeath, id);
- break;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement