Can't use setVisible on mounted object
by Mr Zurkon · in iTorque 2D · 09/01/2011 (11:46 am) · 2 replies
I have mounted a t2dstaticshape to the player object, but I only want it to be visible at certain times. I find that .setVisible doesn't work when the object is mounted to something. Even if the state is set to false, it's still visible in the game.
How can I force it to go visible/invisible?
How can I force it to go visible/invisible?
#2
09/01/2011 (3:07 pm)
I thought I set MountInheritAttributes to false, but I might have missed it. I ended up just setting the alpha on/off instead. I needed to fade out the object when hiding it anyway, so just toggling it with alpha seemed like a good idea.
Torque Owner Scott Wilson-Billing
MeYuMe
setMountInheritAttributes(%inheritAttributes)
Purpose
Mounts an object to another object.
Syntax
%object - t2dSceneObject
The object to mount to.
%offsetX - Float
The x position to mount to in the object space of %object.
%offsetY - Float
The y position to mount to in the object space of %object.
%offset - Vector
The position to mount to in the object space of %object.
%force - Float
The magnitude of the force constantly applied to the object to keep it at the mount point. A value of 0 makes the mount rigid, and thus stuck to the object it is mounted to.
%trackRotation - Bool
Whether or not to track the rotation of the object this is being mounted to.
%sendToMount - Bool
Whether or not to send the object directly to the mount point.
%ownedByMount - Bool
Whether or not the object is deleted when the object it is mounted to is deleted.
%inheritAttributes - Bool
Whether or not to inherit certain attributes from the object this is being mounted to. The inherited attributes are enabled, visible, paused, and flip.
mount(...) Return Value - Vector
The mount ID if successful or -1 if the mount fails.
Notes
Objects can be mounted to any other object regardless of whether they have other mounts, or are mounted themselves. The only restriction is that there cannot be any cyclical mounting (two objects mounted to each other, for example).
The functions listed other than mount only work if the object is already mounted to another object.