Invisible Object Switch

Started by straston, Tue 01/07/2003 11:46:44

Previous topic - Next topic

straston

Hi!

OK, this is my first post in this forum.
I've got trouble with making an "object switch".

What I basically want to do is to
change the display on a "windscreen".

I made both the windscreen displays objects, stack them on each other and change them by switching objects on and off.

It works fine this far.

But then, I want to make the switch "invisible" within a fadeout, so I tried this code:

FadeOut(10);
ObjectOn (0);
ObjectOff(1);
ObjectOff(2);
while (IsObjectOn(0) == 0) Wait(1);
FadeIn(10);

But the switch always occurs after the FadeIn.
Does anybody know how to prevent it?

Bye, straston

frenchy_117

its becuase in the second last line you tell them to turn it on so put that line after the last. i think that will work...
The game is good and i am ugly. dont ever expect the whole package. Thr road through life!!!

Archangel (aka SoupDragon)

#2
Get rid of the while (IsObjectOn(0) == 0) and just leave the Wait(1); bit in.

straston

Quote from: Archangel on Tue 01/07/2003 19:18:55
Get rid of the while (IsObjectOn(0) == 0) and just leave the Wait(1); bit in.

I'm not sure I understand why, but it works now.  :)

So thanks.

Bye,

Straston

Archangel (aka SoupDragon)

It's because even though you've used ObjectOn(0);, it isn't processed (ie. the object isn't actually turned on) until something happens to redraw the screen, such as Wait(). So the object isn't on when you try the conditional "while (IsObjectOn(0) == 0)", and so the wait command never gets called, and the screen doesn't get updated until the end of the FadeIn() function.

I think that's why anyway, someone please correct me if I'm wrong.

SMF spam blocked by CleanTalk