Is there a way to have an actor already transparent when created?

nev

  • *
  • Posts: 386
I searched the forum for the answer, but didn't find anything (maybe wrong keywords?)...
I would like to have a semi-transparent black screen fading in over my scene. The problem is that, when it is created, it is opaque. I tried to fade out the black screen actor in 0 seconds when created and then fading it in, but I got it visible for a fraction of a second when created. Obviously that's disturbing.
So, is there a way to create an actor which is already in a transparent state?
Thanks a lot in advance!
Nev

rob1221

  • *
  • Posts: 9472
Yes, you just have to make the transparent actor in any program capable of doing so and save it in any format that supports transparent images.

Abigayl

  • Posts: 807
If you simply want it invisible when made, in the behavior for it, in the palette go to Actors -> Properties -> bottom is "show sprite for self", drag it into "when created" and change the "show" into "hide".
If you need help, please check my tutorials either here or Kongregate (http://www.kongregate.com/accounts/Abigayl) or come over to my stream: http://www.livestream.com/poweredbyflowers

nev

  • *
  • Posts: 386
Uhm, probably I didn't explained myself very well. I intend to have a not transparent actor being created (by the "create actor" command) with alpha = 0.

nev

  • *
  • Posts: 386
@ abigayl
I posted before beeing able to see your answer. Thanks, I'll try that!

nev

  • *
  • Posts: 386
Tryed it. But, as I suspected, when I use the fade-in block, the actor doesn't appear... (btw, "show sprite for self" is the "Draw", not in "Properties"  ;) )

rob1221

  • *
  • Posts: 9472
I tested the fading with a opaque actor and it worked fine for me.  Is that the first block under "when created"?

coleislazy

  • *
  • Posts: 2607
Hide the sprite when created, then fade its opacity to 0 over 0 seconds. You won't get the split-second "flash". Then, right before you start fading it back in, show its sprite.

nev

  • *
  • Posts: 386
@rob1221
Are you referring to fade-in or fade-out?

@coleislazy
Thanks. Didn't tried yet, but so surely works. A bit convoluted though. An option in the "create" block to set initial alpha would be nice: I will post in the suggestion part of the forum.

rob1221

  • *
  • Posts: 9472
@rob1221
Are you referring to fade-in or fade-out?

When created, I faded the actor out in 0 seconds (I didn't see it), and then I faded it back in over a couple seconds.

nev

  • *
  • Posts: 386
Quote
Quote from: nev on Today at 01:20:43 am
@rob1221
Are you referring to fade-in or fade-out?

When created, I faded the actor out in 0 seconds (I didn't see it), and then I faded it back in over a couple seconds.

I guess you are creating the actor at the very start of a scene, right? If so, the blinking is not to be seen, because it is hidden by the scene fading in. But if it is created after a while, when the scene is already faded in, you shall see the actor appearing for a small fraction of a second. (At least it does so on my iPad...)

rob1221

  • *
  • Posts: 9472
That's correct.  Is there a reason you can't do the same?  You can fade out the actor when created and then at a later point fade it back in.

applaud

  • Posts: 370
@rob - I was doing that with a large actor. The problem was it would occasionally flash on screen before the instant fade out - so its best to use the hide sprite and fade to 0% approach. Then use show sprite and fade in when you want it.