Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* AESTHETICS */
- thr=scr_basicshot(x,y,obj_en_thr,random_range(3,5),random_range(direction+100,direction+260));
- thr.image_xscale = 4;
- thr.image_yscale = 4;
- thr.image_angle = random(360);
- /* CREATION OF TURRETS */
- if y > yview-(sprite_height/2) && made = 0
- {
- // Creation of turrets
- tur1 = instance_create(x-18,y-18,obj_en_platTUR);// Top-left
- tur2 = instance_create(x+18,y-18,obj_en_platTUR);// Top-right
- tur3 = instance_create(x-18,y+18,obj_en_platTUR);// Bottom-left
- tur4 = instance_create(x+18,y+18,obj_en_platTUR);// Bottom-right
- tur1.parent = (self).id;
- tur2.parent = (self).id;
- tur3.parent = (self).id;
- tur4.parent = (self).id;
- tur_count = 4;
- made = 1;
- }
- /* POSITIONING OF TURRETS */
- if made = 1
- {
- tur1.x = x - 18; // Top-left
- tur1.y = y - 18;
- tur2.x = x + 18; // Top-right
- tur2.y = y - 18;
- tur3.x = x - 18; // Bottom-left
- tur3.y = y + 18;
- tur4.x = x + 18; // Bottom-right
- tur4.y = y + 18;
- }
- /* ATTACK PATTERNS */
- if tur_count > 0
- {
- // Pattern Duration/Reset of timers
- timer += 1;
- atk_timer += 1;
- if timer = 120
- {
- timer = 0;
- atk_timer = 0;
- if atk_phase = 1 then atk_phase = 2 else atk_phase = 1;
- }
- // First Pattern
- if atk_phase = 1
- {
- if atk_timer = 30
- {
- with tur1 event_user(1);
- with tur2 event_user(1);
- with tur3 event_user(1);
- with tur4 event_user(1);
- scr_playsnd(global.enemyshot2,1);
- atk_timer = -30; // 90 steps after first call
- }
- }
- // Second Pattern
- if atk_phase = 2
- {
- if atk_timer = 4
- {
- with tur1 event_user(2);
- with tur2 event_user(2);
- with tur3 event_user(2);
- with tur4 event_user(2);
- scr_playsnd(global.enemyshot1,1);
- atk_timer = 0;
- }
- }
- }
- // Final pattern - Only occurs if all turrets are destroyed
- if tur_count = 0
- {
- timer += 1;
- if timer >= 4
- {
- scr_playsnd(global.enemyshot3,1);
- scr_basicshot(x,y,obj_bullet4,4,aim);
- aim += 45;
- if aim >= 360 then aim = 0;
- timer = 0;
- }
- }
- /* MOVEMENT BEHAVIOUR */
- switch phase
- {
- case 1: // Moving down
- {
- if y > yview+160
- {
- // if x == 160 do nothing
- if x > 160 then direction = 180;
- if x < 160 then direction = 0;
- speed = 1;
- phase = 2;
- }
- break;
- }
- case 2: // Moving left/right
- {
- if x < 40 || x > 280
- {
- direction = 90;
- speed = 0.5;
- phase = 3;
- }
- break;
- }
- case 3: // Moving up, then left/right
- {
- if y < yview+40
- {
- if x > 160 then direction = 0;
- if x < 160 then direction = 180;
- speed = 0.35;
- }
- break;
- }
- }
- /* DEATH HANDLING */
- if x < -(sprite_width/2)
- || x > 320+(sprite_width/2)
- || y > yview+320+(sprite_height/2)
- then instance_destroy();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement