0 votes

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


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


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



in Engine by (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.

by (178 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?



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.



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.



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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.