(UPD1: Please, look at reply below, where we found that problem with shaders which doesn’t give a permission to change modulate:a property)
Well, I have an enemy scene (CharacterBody2D) which has:
I wanna make it appear/disappear when it comes close to the player’s character. All is fine with this stuff except animation smoothness… It changes visibility like from true to false (nothing tweening). I’ve tried those methods:
I just tested your tweening method and it works fine.
Maybe the problem is that you’re setting GhostEnemy.visible = false somewhere in your code, but it looks like it has nothing to do with your tweening.
Where are you executing visibility_off? can we get some context?
You’re totally right! problem was with shaders… ops… my bad, I don’t know why I decided to ask a question without testing tween on another sprites, sorry, and thanks for help)
Problem was with my HitFlashComponent (where is my shader) which regulates sprite’s color
To be honest, it’s my first experience with gdshaders, I’m bad at this)
You can use animation player to make it invisible or visible its very easy to use.(With modulate)
As you need when it comes closer to player you can make to play animation at that time.
Ah i am completely beginner at that point( i have used animation player to fade out,thats why i could help you with this)so with shaders i cant help you,sorry😅
Are you doing that with a shader? Then why don’t you do it ALL with the shader?
I feel like doing it half-code and half-shader will get you unexpected results if you don’t handle that correctly.
Just define a uniform called “alpha” or “alpha_uniform” or something and set the value there. Keep in mind it has to be a value between 0 and 1.
Then in your shader, line 12, just do this:
COLOR = vec4(final_color.r, final_color.g, final_color.b, alpha_uniform)