Slap an Area2D on that tree and use it’s body_entered() and body_exited() signals to control opacity
Thanks for your answer,
I will try this out,
But currently I have all my trees on a seperate TileMap so im guessing and correct me if im wrong, But if i put the Area2D on this to control the opacity, Am I right in thinking that if I went to one of the trees this would make all trees on the map have the same opacity or just the one where the player is at?
And if that is the case would it be best to have all trees seperate as a staticbody? or if there some other better method
tamanor | 2020-05-03 15:34
I tried the body_entered signal,
At first i tested it and made it return a print in the output which worked when the player entered the body of the tree,
But then i tried with adding
if body.get_name() == “Player”:
modulate.a = 0.5
which currently does not seem to be doing anything with the TileMap I can only guess that it only effecting the Area2D.
Is there anyway to make this work with Tilemaps or does all my trees have to be sererate Area2D which kinda sounds like it would make the game have lots of uneeded things.
tamanor | 2020-05-03 17:52
try selecting area2d parent node containing the sprite and then change its opacity
I will take a look and see if i can get it to work with tilemap again,
But currently i managed to get it working VIA a StaticBody2D not sure if this is an optimal way since each tree is it own thing, But for testing purposes it working.
Off topic quests but you may or may not know and I thought it would save me opening a new question.
I currently have a 2d Player that has animations for W, A, S, D which is all working fine, But im having a small issue with the diagonal movement. I want to make it so if you move in a diagonal direction it forces the use of the Left(A) and Right(D) animations,
Because currently if i press W and then A it will use the walking up animation when going diagonal left.
tamanor | 2020-05-07 16:17