visible

Sets the visibility of the instance.

Syntax:

visible


Returns: Boolean


Description

An instance can be flagged as visible or not by setting this variable to true (visible) or false (invisible). This works by telling GameMaker: Studio to skip the draw event for this instance, so care must be taken when using this as it means that no code placed in the draw event will be run while the instance is not visible.


Example:

if other.visible = true
   {
   x = xprevious;
   y = yprevious;
   }

The above code will check the visible flag of the "other" instance in a collision and if it is set to true move that instance back to its previous position.


Back: Instance Properties
Next: persistent
© Copyright YoYo Games Ltd. 2018 All Rights Reserved