The Daily Click ::. Forums ::. Klik Coding Help ::. Testing an object's semitransparency
 

Post Reply  Post Oekaki 
 

Posted By Message

noahsummers



Registered
  17/01/2010
Points
  64
14th February, 2010 at 05:11:18 -

Is there a way to test an object's "SemiTrans" value in an event? I thought that testing whether something was "invisible" would be the same as "Is SemiTrans("etc.")=128?," but apparently not. (I had my objects set to fade away and destroy themselves once invisible, but then one's death animation played a few seconds afterward, meaning it was still there after all...)

 
eight bit believer

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
14th February, 2010 at 05:29:32 -

Well . . . try adding pick one to the event.

I've worked with this today and it works for me.

For some reason when you have multiple objects that are semi transparent and check to see if they are invisible, none of them get destroyed until ALL of them are invisible.

Adding pick one solves this problem.

 
n/a

Spitznagl

Cabinetmaker

Registered
  06/12/2008
Points
  4260

The SpinsterVIP MemberHas Donated, Thank You!Picture Me This Round 29 Winner!Picture Me This Round 31 Winner!Picture Me This Round 36 Winner!
14th February, 2010 at 05:34:50 -

Under Special -> Compare two general values.

SemiTrans( "Active" )
=
128

The "Compare two general values" doesn't work with multiples instances and groups though, so if this isn't for a unique object, it would be better to set one of the object's alterable values to it's SemiTransparency and then compare it to 128.

 
...

noahsummers



Registered
  17/01/2010
Points
  64
14th February, 2010 at 06:31:34 -

GamesterXIII: That's odd, cause these two objects go invisible at the exact same time. I shall keep that in mind anyway.

Spitznagl: Thanks! Luckily, all of the objects I'm using the effect with never have multiple instances onscreen.

 
eight bit believer

aphant



Registered
  18/05/2008
Points
  1242
14th February, 2010 at 12:32:04 -

The death/destroyed animation plays when the object is destroyed via event. The object isn't destroyed until after the animation finishes. So, add the semitransparency to the destroy animation, and you can just destroy the object without any special conditions for transparency.

 

GamesterXIII



Registered
  04/12/2008
Points
  1110

I am an April Fool
14th February, 2010 at 17:08:01 -


Originally Posted by blendroid
GamesterXIII: That's odd, cause these two objects go invisible at the exact same time. I shall keep that in mind anyway.



I see. I know you said there won't be multiple instances, but if one is at semi-transparency 127 and another gets created, when it hits 128 it will still exist until the next one hits 128, unless another is created again.

 
n/a

noahsummers



Registered
  17/01/2010
Points
  64
14th February, 2010 at 17:37:40 -

GamesterXIII: There aren't any objects being created, only two unique objects being destroyed: I'm working on an Arkanoid clone, and when the player finishes a level, I want the paddle and ball to fade away and terminate themselves (in case the paddle and ball might collide when invisible before the game jumps to the next frame, ruining the illusion. The ball could also fall out of the field and make the player lose a life inadvertently.)

Aphant: I'm actually using separate objects for death animations. Not necessarily the best way to do it, but using different sets of animations on the same object wouldn't save any coding, at least in this particular game. Plus I just got used to doing this when I used Game Maker. The reason I knew the objects were still "alive" was that the invisible ball left the playing field and the player exploded.

 
eight bit believer
   

Post Reply



 



Advertisement

Worth A Click