if (varX == 1)
{
Player.transp += 0.1;
}
simranjit wrote:
- Code: Select all
if (varX == 1)
{
Player.transp += 0.1;
}
while(Actor.transp != 1)
{
Actor.transp += 0.1;
}
MrJolteon wrote:Or you can try
- Code: Select all
while(Actor.transp != 1)
{
Actor.transp += 0.1;
}
This should work in a Create Actor event.
lcl wrote:Using that code will freeze Game Editor.
while is a keyword that repeats the same code over and over again during the same frame as long as the condition is true. And transp, being a double variable, will never be exactly 1, so the condition is never false and so the frame the actor gets created will never end - in other words, the program will freeze.
MrJolteon wrote:Well I tried at least...
PerrySteven wrote:I tried what was suggested, but I didn't get to testing without coming up with compiler errors: Illegal Operations
So, I had one actor named intro, and in the code I tried to increment intro.transp but the compiler told me it was an illegal operation.
I think I have one idea I could try, perhaps to have a variable incrementation within one of the ChangeTransparency's function fields.
myActor.transp += 0.05;
PerrySteven wrote:I tried again with a different actor called "player", and this time it came up with no errors. But the game froze when I ran it.
transp += 0.01;
Opium wrote:You guys are slow to extent that makes it seem rather amusing.
@OP
Click the actor you wish to go transparent and Add a Draw Actor event and select the Script Editor action.
And paste this code:
- Code: Select all
transp += 0.01;
First off, the transp member variable per se is of dynamic type and it cannot go higher than 1. And that means the condition is redundant.
0.01 is the factor. If you want it faster, lower the value with say the half of it.
If you want to abort the transition disable the draw actor event of the actor from the Event Disable event or from some Script Editor.
You must elaborate what you mean by "changing" on the other side. What I show'd you is technically "changing", but it appears to be not so useful.
It may be useful to you, so it depends on information you didn't provide.
float GradualChange = 0.05;
transp += GradualChange;
if(transp >=1)
transp = 1;
Users browsing this forum: No registered users and 1 guest