A
AtomicToilet
Guest
Howdy folks.
My issue involves two on-screen meters; one for the player switching between modes (Energy bars) and the other as a counter (that counts down when enemies are destroyed). They both function as they should, HOWEVER, they also both leave behind an image once the game view moves, like so [click to see full size images]
I've cobbled together code from two different sources
(
and
)
My resulting code is as follows:
-------------------------
-----------------------------------------------------------------------------------
-------------------------------------------------------
nb. I know the bars and overlay for obj_energy_gui aren't lined up; still tweaking this
I have no idea why both gui elements leave images behind once the view moves. If it's really obvious how to fix it, pretend I'm normally a lot smarter
Thanks, GM hivemind!
My issue involves two on-screen meters; one for the player switching between modes (Energy bars) and the other as a counter (that counts down when enemies are destroyed). They both function as they should, HOWEVER, they also both leave behind an image once the game view moves, like so [click to see full size images]
I've cobbled together code from two different sources
(
My resulting code is as follows:
-------------------------
Code:
Information about object: obj_energy_gui
Sprite: spr_energy_bars
Solid: false
Visible: true
Depth: -10000
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
image_speed = 0;
image_index = 0;
Step Event:
execute code:
if (keyboard_check_pressed (ord('1')))
{
image_index = 0;
}
if (keyboard_check_pressed (ord('2')))
{
image_index = 1;
}
if (keyboard_check_pressed (ord('3')))
{
image_index = 2;
}
if (keyboard_check_pressed (ord('4')))
{
image_index = 3;
}
if (!instance_exists(obj_rex_mouse))
{
image_alpha = 0;
}
Draw GUI Event:
execute code:
draw_self();
Code:
Information about object: obj_energy_bars
Sprite:
Solid: false
Visible: true
Depth: -5000
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Draw GUI Event:
execute code:
if instance_exists(obj_rex_mouse)
{
draw_sprite(spr_energy_bars_border,1,7,8);
draw_sprite_ext(spr_energy_blue,1,7,8,obj_rex_mouse.blue/100,1,0,c_white,1);
draw_sprite_ext(spr_energy_green,1,7,8,obj_rex_mouse.green/100,1,0,c_white,1);
draw_sprite_ext(spr_energy_purple,1,7,8,obj_rex_mouse.purple/100,1,0,c_white,1);
draw_sprite_ext(spr_energy_red,1,7,8,obj_rex_mouse.red/100,1,0,c_white,1);
}
Code:
Information about object: obj_asteroid_meter
Sprite: spr_asteroids_meter
Solid: false
Visible: true
Depth: -10000
Persistent: true
Parent:
Children:
Mask:
No Physics Object
Create Event:
execute code:
global.asteroids = 50;
Step Event:
execute code:
if (!instance_exists(obj_rex_mouse))
{
instance_destroy();
}
Draw GUI Event:
execute code:
draw_self();
draw_set_halign(fa_right);
draw_set_valign(fa_top);
draw_set_font(fnt_rocks);
draw_set_color(c_white);
draw_text(975,55," " + string (global.asteroids));
nb. I know the bars and overlay for obj_energy_gui aren't lined up; still tweaking this
I have no idea why both gui elements leave images behind once the view moves. If it's really obvious how to fix it, pretend I'm normally a lot smarter
Thanks, GM hivemind!