SOLVED Assigning an object to a variable?

In my game I have created an object for my player's lives, and I also have a global variable called 'global.life'. Is there anyway that I could get the obj_lives to link to the global.life variable so that the hearts show up instead of just a number? I have included pictures of my code below incase that helps.

1623579615703.png 1623579650374.png
1623579675160.png 1623579724694.png <- this is how the lives look in game currently
 
Last edited:

Mr Magnus

Viking King
You don't need the object: just draw the sprite directly.

GML:
//obj_game draw GUI event
for(var i = 0; i < global.lives; i++){
    draw_sprite(spr_lives, 0,  32+ 70*i,  32 ); ///Replace values as you want.
}
 
Top