0 votes

I basically want a way for my character too have his head like this.

https://imgur.com/a/QTXrBsP

and for the charatcer too be behind the leaves as currently its like this

https://imgur.com/a/afWVBr6

and if the character is behind the tree for the tree to lower opacity so the player can see the character, thats if this is all possible

Thanks

Jack

asked Aug 27, 2018 in Engine by Maccap (12 points)

1 Answer

+1 vote

When the player's X coordinate is in the range of the tree (Xtree, Xtree + tree.length.x) then the tree should have a lower opacity.

answered Aug 27, 2018 by ZacB (173 points)

I'm back home now and I have implemented the following lines of code that you have given me and it produces an error due to the fact that there is no identifier of which is named Player.

Also what else would I have to add to the script?

Thanks

Jack

Ok so my only issue at the moment is the fact that it does not have a var for player because that var is basically empty, if it changes the scale of the sprite then i have a var for that already if its changing the something in the kinematic2D node then i dont know how to call for that since the script is already on the node and lastly im not sure if it would be on collision2D node.

Thanks

Jack

Ok so I have thought of the most inefficent thing ever but i think it might work so basically have two collisionShape2D one named treeBase and one named treeUpper, when player collides with treeUpper it will place the player behind the tree and maybe in the future I can mess around with the opacity some how. It sounds like a crazy plan but i feel like it might work.

mmh what a strange idea. But not that bad actually ;)

"player" was just a placeholder. Replace it by your object (player) name

Hmm now the only issue is how the heck do i go around creating what i just explained, see this is my main issue i can think of stuff like this but dont know how to actually make it practically.

Thanks

Jack

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.