Inventory Question

If I have an object collision where a laser meets an asteroid and every time it does I have global.silicate += 10; and the create event for the player is global.silicate = 0; how would I keep an onscreen representation of how much silicate I currently have. Is this where I can use a draw_text function to get this number?
 

Rexzqy

Member
I dont really see how this is being related to inventory, but you can do draw_text(whateverx,whatevery,string(global.silicate));
 

Joe Ellis

Member
Do you want to keep the global.silicate after the player dies and respawns? You'd wanna not reset it to 0 in the player's create event and have it controlled by whether you start a new game or not, or level. You could put it in the room creation code, I'd make a function level_init() or something, which sets all the global variables up to what they should be like at the start of the level, then if the player dies and the level restarts, you could use a global variable "player_dead", or "level_restart", and in the level_init function, check if this variable is true or not.
If it is true, you'd keep any variables that should stay the same after dying, and if say you started a new game or go to a new level you'd set global.player_dead to false just before. This'd be a simple fix to put in place, but it'd probably be better to handle everything with separate functions.
 
Do you want to keep the global.silicate after the player dies and respawns? You'd wanna not reset it to 0 in the player's create event and have it controlled by whether you start a new game or not, or level. You could put it in the room creation code, I'd make a function level_init() or something, which sets all the global variables up to what they should be like at the start of the level, then if the player dies and the level restarts, you could use a global variable "player_dead", or "level_restart", and in the level_init function, check if this variable is true or not.
If it is true, you'd keep any variables that should stay the same after dying, and if say you started a new game or go to a new level you'd set global.player_dead to false just before. This'd be a simple fix to put in place, but it'd probably be better to handle everything with separate functions.
If the player dies then these values will restart also.
 

Joe Ellis

Member
Oh ok, sorry, I just had the feeling you wanted it to not change when the player dies for some reason when I first read it. I just wondered if that was a "side problem" you had, I think it was cus you mentioned the player setting it to 0.
But yeah, using draw_text is the standard way for drawing text on gui stuff, you can also make a font out of sprites, like a sprite with 26 subimages, for each letter etc. then map the characters of the string to that. It depends what look you need to achieve, if it can be done with a font it's obviously easier than the more manual ways, but there's certain things you can't do with a font, like oldskool gradient fonts like on street fighter or old snes games, or something like this:
 
Thanks guys. I appreciate the input. Now I just have to make a working laser beam that will go from my miner ship to the asteroid and once that collision happens add to the silicate count.
 
Top