Set Transparency[solved]

Started by Candle, Sun 23/04/2006 00:38:16

Previous topic - Next topic

Candle

How can I code the player and the object so they go transparent at the sametime?

Code: ags
object[0].Visible = true;
int trans = object[0].Transparency;
while (trans < 100) {
  trans++;
  object[0].Transparency = trans;
  Wait(1);
}  
character[MELT].ChangeRoom(4, 90, 171); 


nihilyst

Just add

character[MELT].Transparency = trans;

to the while construction. That should work (and wasn't that hard to find out, either).

Candle

Quote from: nihilyst on Sun 23/04/2006 00:44:27
Just add

character[MELT].Transparency = trans;

to the while construction. That should work (and wasn't that hard to find out, either).
No need to add your snide remark.

nihilyst

Sorry, I didn't want to to sound arrogant. But it still was pretty obvious, wasn't it? ^^

Candle

Incase anyone would need it.
Code: ags
int trans = object[0].Transparency;
character[MELT].Transparency = trans;
while (trans < 100) {
  trans++;
  object[0].Transparency = trans;
  character[MELT].Transparency = trans;
  Wait(1);
} 

Candle

I'm trying to reverse the transparency but not working, what do I have wrong?
Code: ags
int trans = character[MELT].Transparency;
while (trans < 100) {
  trans--;
  character[MELT].Transparency = trans;
  Wait(1);
}  


Akumayo

You need to change your while statement to:

Code: ags

while (trans > 0) {


I think that should solve it.
"Power is not a means - it is an end."

Candle

Yes I did that too
int trans = character[MELT].Transparency;
while (trans < 0) {
  trans++;
  character[MELT].Transparency = trans;
  Wait(1);

Didn't seem to work?

Akumayo

Now you've accidently reversed the sign on trans, and your symbol was backwards.Ã, 

Like this would work, I think, for fading the character back in:Ã,  (changes in red)

int trans = character[MELT].Transparency;
while (trans > 0) {
Ã,  trans--;
Ã,  character[MELT].Transparency = trans;
Ã,  Wait(1);
}
"Power is not a means - it is an end."

Candle

Thanks , thats what I had wrong. works fine now.

SMF spam blocked by CleanTalk