Page 1 of 1

Appear briefly then Disappear

PostPosted: Sat Jun 10, 2006 3:09 am
by trajecto
How can I make something appear briefly then disappear?

For example: My character collides with a pickup, his score goes up, the pickup disappears, a text point value actor appears, then after a pause, disappears. Standard stuff.

Thanks!

PostPosted: Sat Jun 10, 2006 4:45 am
by Just4Fun
Hi trajecto:

I may be off base here, but I would really like to be able to help you so I thought I would give a try in answering your question. If you use a drawActor --> script editor script like:

transp += 0.015;
if (transp >=1)
transp = 0;

This will cause the actor to fade out and then 'blink' back and reappear.

HTHs :wink:

PostPosted: Sat Jun 10, 2006 5:01 am
by trajecto
Hi there Just4Fun, thank you so much! I tried it, looks good!

Now if it just wouldn't repeat after it diminishes... how to?

PostPosted: Sat Jun 10, 2006 5:27 am
by makslane
You can use a timer

PostPosted: Sat Jun 10, 2006 5:30 am
by trajecto
Thanks Makslane, I got it to work though with:

transp += 0.015;
if (transp >=1)
DestroyActor("Event Actor");



Curious though, how could I use a timer?

PostPosted: Sat Jun 10, 2006 6:01 am
by makslane
My character collides with a pickup, his score goes up, the pickup disappears, a text point value actor appears, then after a pause, disappears. Standard stuff.

When the character collides with a pickup, create a timer, make character invisible, create the text point (with a timer to destroy), and, in the timer event of character, make it visible again.

PostPosted: Sat Jun 10, 2006 6:10 am
by Just4Fun
trajecto:

Now if it just wouldn't repeat after it diminishes... how to?


Another way to control the fade looping besides using the DestroyActor function or a timer is to place the myActor.transp = 0; script in another actor's event. For example, maybe you could place the script in your actor that is collided with. I tried it with two actors: one with a DrawActor event and one with a MouseDown event. It worked just fine.

I suppose this is all just extra non-essential verbage since you already have the code working, but I find the number of ways to do a thing in GE interesting.

And trajecto, thanks again for all that you contribute to us. I've learned a lot from you. Image

PostPosted: Sat Jun 10, 2006 1:24 pm
by trajecto
You are welcome Just4Fun,

I have fun writing the tutorials and will keep them coming!