GameMaker Text won't appear when hovering over an invisible object

I have it so that when I hover the mouse over an object, it displays text at the bottom of the screen as to what that object is. However, this only works with visible objects. I want it to also work with invisible objects. All these objects (visible and invisible) have the same parent controlling this text command, so I know that part isn't broken. I assume because the object is invisible, the text is too...? Is there something specific I am missing? How can I make the text appear when hovering over an invisible object?
Thanks.
 

Simon Gust

Member
invisible objects will not execute their draw-events at all, so any code in there no matter if it's related to drawing a sprite, calculating something or displaying text will not run.
To avoid this, you can move the text code outside the invisible object and put it in another controller and access the invisible objects via with().
 
Are you using GML? Because making the object invisible by setting visible = false will skip the draw event, which if that's where your drawing code is (I assume so) then that would be why.
 

chamaeleon

Member
Or don't have invisible objects, implement the draw method, and inside the draw method only draw what you want displayed, if anything, or nothing at all. If you call no functions to draw sprites or text, they are effectively invisible, but they will still have the collision mask as represented by the assigned sprite.
 
A fair number of the invisible objects are hit boxes laid over specific parts of an overall image. I need the hit box to be something other than transparent, that way, when it is clicked on a specific spot, it will respond. Making it transparent means the collision mask will not be precise like I need it to be.

I am using mostly GML, but have un-clicked the "Visible" checkbox for the hit box objects.

I will have to dabble with your guys' suggestions. Thanks, I'll let you know.
 

chamaeleon

Member
A fair number of the invisible objects are hit boxes laid over specific parts of an overall image. I need the hit box to be something other than transparent, that way, when it is clicked on a specific spot, it will respond. Making it transparent means the collision mask will not be precise like I need it to be.

I am using mostly GML, but have un-clicked the "Visible" checkbox for the hit box objects.

I will have to dabble with your guys' suggestions. Thanks, I'll let you know.
You can assign a collision mask sprite that is different from the assigned sprite that is drawn, if that is required, in the object editor or in code.
 
Top