0 votes

I mean, when we shoot, the arrow is visible until it hits the target
For example, when shooting with a bow, the arrow is visible
I read about this in Godot Document, but it was very difficult, please help me

in Engine by (180 points)

So, are you saying, make the bullet visible, vs just using a raycast?

In any case, the arrow can be seen at the time of firing until it hits the target

Well, you see, the code will be a lot different if you're using a raycast.

Wait for me to send you the project

Please help me very need it

1 Answer

0 votes

You could make the enemy detect when the arrow hits them, and the have the arrow become a child node of the enemy. Also, make sure to give the arrow a lower z-index so it looks like it has actually gone through them.

For this to happen you'd probably need to make the offset of the arrow so that it goes through the parent. If not, then the arrow will probably be floating which doesn't look realistic.


by (304 points)

Please help me Millard please

if you want to delete the arrow, use the queue_free() function. if you only want to hide it, use the hide() function. (you can use the show() function to make it visible again. Both these functions would be on the arrow script.

does that solve your problem?

P.S. no problem about the flag, i was just looking for clarity. :D

it's really hard
Please Give an example(source code or...)

So sorry for not replying. If you don't have an area2D then add one to the bullet. Try this:

var enemy = false
var enemyname = $enemy    

func _ready():
    if enemy == true:
        enemy_health = -10
func _on_Area2DBullet_area_entered(area):
    if body = enemyname:
        enemy == true

Did it work?

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.