After more tests, I must admit that, even if the script works perfectly, the result doesn't look good.
The reason is very simple:
On a close-up layer there are a background and several nodes above.
When, per example, the background opacity is set on 100, the nodes are set on 100 + 100 (=the background below) : the opacity level of the nodes is added to the opacity level of the background.
So when the script is executed, the opacity changes like this:
background : 5 / Nodes : 5 + 5=10
background : 55 / Nodes : 55 + 55 = 110
background : 105 / Nodes : 105 + 105= 210
...
The nodes appear 2x faster than the close-up background.
The only way I see to get rid of that problem would be to cut holes in the close-up background and put the nodes exactly above those holes.
But is sounds too complicated.
So I'll just forget about having the close-up fade-in / fade-out.
I have another question about opacity.
Is there a way to change opacity for a subframe?My heroine is a Japanese girl. So everytime she enters a house, she is supposed to take off her shoes.
My idea was to add her shoes as subframe and put the AlphaChannel to 0 everytime she's inside a house.
So there would be no need to load a new actor.
I've tried to do it this way:
1. I've added a Custom Property to the floor named "xShoes" which values are "shoes" when the character is outside and "feet" when she is inside.
2. On the frames of the actor's animation, I add a subframe of the naked feet and a subframe of the shoes.
Then I add a event called "EventShoes" and I attach this script to the sprites:
#include "scripts\base.inc"
////////////////////////////////////////////////////////////////////////////////
//on "event"
//{
// ...
//}
on "EventShoes"
{
// get a region the actor is standing in
if (RegShoes!=null)
{
switch(RegShoes.xShoes)
{
case "shoes":
break;
case "feet":
break;
}
}
}
As you can see, I used the script for implementing footsteps sounds.
But I don't really understand how to call SubFrames.
And... nothing happens when I play the game.
My script is obviously all wrong.
Is there a way to fix it?
Or maybe it's just impossible to change the opacity of a subframe?
Thank you!