【GAMEMAKER】Space Shooting Games

 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:
set variable ShotTimer relative to -1
Keyboard Event for <no key> Key:
set the horizontal speed to 0
Keyboard Event for <Space> Key:
if expression ShotTimer<0 is true
      create instance of object objPBullet at relative position (sprite_width/2,0)
      set variable ShotTimer to 4
Keyboard Event for <Left> Key:
set the horizontal speed to -4
Keyboard Event for <Right> Key:
set the horizontal speed to 4

Information about object: objEnemy
Sprite: sprEnemy
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable hits to 4
start moving in directions 010000000 with speed set to 3
Step Event:
execute code:

  a=round(random(20));
  if a=1 {
    if self.hspeed!=0 {
      self.hspeed=0;
    } else {
      self.hspeed=random(10)-5;
    }
    sprite_index = (sprEnemy);
    a=round(random(10));
    if a=1 {
      self.hspeed=0;
    }
    if self.hspeed<0 {
      sprite_index =(sprEnemyLeft);
    }
    if self.hspeed>0 {
      sprite_index =(sprEnemyRight);
    }
    }
    if x<objPlayer.x+45 and x>objPlayer.x {
      instance_create(30+self.x, self.y, objBullet);
    }


Collision Event with object objPBullet:
for other object: destroy the instance
set variable hits relative to -1
if expression hits=0 is true
      destroy the instance
Other Event: Intersect Boundary:
destroy the instance

Information about object: objController
Sprite: sprController
Solid: false
Visible: false
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set Alarm 0 to 30
Alarm Event for alarm 0:
set Alarm 0 to 100
create instance of object objEnemy at position (random(window_get_width()-100)+50,0)

Information about object: objBullet
Sprite: sprBullet
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
if expression instance_number(objBullet)>1 is true
      destroy the instance
start moving in directions 010000000 with speed set to 12
Other Event: Intersect Boundary:
destroy the instance

Information about object: objPBullet
Sprite: sprPBullet
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

No comments:

Your Brain on Art

My Q&A with Susan Magsamen and Ivy Ross ͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏     ­͏    ...

Contact Form

Name

Email *

Message *