Showing posts with label 【GAMEMAKER】Energy. Show all posts
Showing posts with label 【GAMEMAKER】Energy. Show all posts

Wednesday, May 12, 2021

【GAMEMAKER】Energy

 Information about object: myPlayer

Sprite: sprPlayer
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Create Event:
set variable myEnergy to 100
Keyboard Event for <Left> Key:
if myEnergy is greater than 0
      set variable myEnergy relative to -1
Keyboard Event for <Right> Key:
if myEnergy is less than 100
      set variable myEnergy relative to +1
Mouse Event for Left Button:
execute code:

myEnergy=random(100);
io_clear();

Information about object: objController
Sprite: sprController
Solid: false
Visible: true
Depth: 0
Persistent: false
Parent:
Children:
Mask:
No Physics Object
Draw Event:
execute code:

pen_color = make_color_rgb (150, 150, 150);
brush_color = make_color_rgb (150, 150, 150);
x1=5;
y1=window_get_height()-15;
x2=110;
y2=window_get_height()-5;
draw_rectangle(x1, y1, x2, y2, true);


if (instance_exists(myPlayer)) {
  pen_color = make_color_rgb(0, 0, 255);
  brush_color = make_color_rgb(0, 0, 255);
  x1=7;
  y1=window_get_height()-13;
  x2=7 + myPlayer.myEnergy;
  y2=window_get_height()-7;
  draw_rectangle(x1, y1, x2, y2, false);
}