【GAMEMAKER】Invaders

 Information about object: objInvader1

Sprite: sprInvader1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children
objInvader2
objInvader3
objInvader4
objInvader5
Mask:
No Physics Object
Create Event:
set variable global.Dir to 1
set variable image_speed to 0.1
Step Event:
execute code:

if floor(random(750))=1 instance_create(x+sprite_width/2,y,objEnemyBullet);
Collision Event with object objStopper:
set variable global.Dir to global.Dir*-1
for all objInvader1: jump relative to position (16*global.Dir,32)
for all objInvader2: jump relative to position (16*global.Dir,32)
for all objInvader3: jump relative to position (16*global.Dir,32)
for all objInvader4: jump relative to position (16*global.Dir,32)
for all objInvader5: jump relative to position (16*global.Dir,32)
Collision Event with object objPlayerBullet:
destroy the instance
for other object: destroy the instance
play sound sound0; looping: false
Other Event: Animation End:
jump relative to position ((16*global.Dir),0)

Information about object: objInvader2
Sprite: sprInvader2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: objInvader1
Children:
Mask:
No Physics Object

Information about object: objInvader3
Sprite: sprInvader3
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: objInvader1
Children:
Mask:
No Physics Object
Information about object: objInvader4
Sprite: sprInvader4
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: objInvader1
Children:
Mask:
No Physics Object

Information about object: objInvader5
Sprite: sprInvader5
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent: objInvader1
Children:
Mask:
No Physics Object

Information about object: objBarrier
Sprite: SprBarrier
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable image to 0
Step Event:
set variable image_single to image
Collision Event with object objInvader1:
destroy the instance
Collision Event with object objPlayerBullet:
execute code:

image+=1;
if image>4 instance_destroy();
for other object: destroy the instance
Collision Event with object objEnemyBullet:
for other object: destroy the instance

Information about object: objPlayer
Sprite: sprPlayer
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable ShotTimer to 0
Step Event:
execute code:

hspeed=0;
ShotTimer-=1;
if keyboard_check(vk_left) hspeed=-4;
if keyboard_check(vk_right) hspeed=4;
if keyboard_check(vk_space) {
  if ShotTimer<0 {
    instance_create(x+sprite_width/2,y,objPlayerBullet);
    ShotTimer=15;
  }
}
 
EnemyCount=instance_number(objInvader1)+instance_number(objInvader2)+instance_number(objInvader3)+instance_number(objInvader4)+instance_number(objInvader5);
if EnemyCount=0 {
  //You would advance to the next level here
  if show_question("You have completed the demo.## Would you like to play again?") {
    game_restart();
  } else {
    game_end();
  }
}

    
Collision Event with object objInvader1:
execute code:

if show_question("You have lost!##Would you like to play again?") {
  game_restart();
} else {
  game_end();
}

Collision Event with object objEnemyBullet:
execute code:

if show_question("You have lost!##Would you like to play again?") {
  game_restart();
} else {
  game_end();
}

Other Event: Game Start:
Open a URL: 0

Information about object: objStopper
Sprite: sprStopper
Solid: true
Visible: false
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object

Information about object: objPlayerBullet
Sprite: sprPlayerBullet
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
start moving in directions 000000010 with speed set to 8

Information about object: objEnemyBullet
Sprite: sprEnemyBullet
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
start moving in directions 010000000 with speed set to 8

No comments:

Top 3 UX Design Articles of 2024 to Remember

Based on most subscriptions ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­...

Contact Form

Name

Email *

Message *