Tuesday, May 11, 2021

【GAMEMAKER】Display

 Information about object: objController

Sprite: sprController
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable Hull to 0
set variable Laser to 0
set variable Engine to 0
set variable Display to 0
Draw Event:
execute code:

pen_color=c_blue;
brush_color=c_green;

Display=0;
for (i=0; i<instance_count; i+=1) {
  iii = instance_id[i];
  if iii.Display=1 {
    Display=1;
  }
}
if Display=1 {
  draw_rectangle(10,10,130,100, true);
  draw_text(20,20,"Hull - "+string(Hull)+"%");
  draw_text(20,40,"Laser - "+string(Laser)+"%");
  draw_text(20,60,"Engine - "+string(Engine)+"%");
}

Information about object: objPlane1
Sprite: sprPlane1
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable Hull to floor(random(100))
set variable Laser to floor(random(100))
set variable Engine to floor(random(100))
set variable Display to 0
Step Event:
execute code:

if mouse_x>x and mouse_x<x+sprite_width and mouse_y>y and mouse_y<y+sprite_height {
  objController.Hull=Hull;
  objController.Laser=Laser;
  objController.Engine=Engine;
  Display=1;
} else {
  Display=0;
}


Information about object: objplane2
Sprite: sprPlane2
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable Hull to floor(random(100))
set variable Laser to floor(random(100))
set variable Engine to floor(random(100))
set variable Display to 0
Step Event:
execute code:

if mouse_x>x and mouse_x<x+sprite_width and mouse_y>y and mouse_y<y+sprite_height {
  objController.Hull=Hull;
  objController.Laser=Laser;
  objController.Engine=Engine;
  Display=1;
} else {
  Display=0;
}


No comments:

Post a Comment