|
|
|
|
Reply From: |
Amateur.game.dev. |
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.
https://forum.godotengine.org/9806/reparent-node-at-runtime
https://forum.godotengine.org/1754/how-to-change-the-parent-of-a-node-from-gdscript
I’m sorry, but I did not understand. Can you give an example?
I think Amateur.game.dev. is explaining how to make the arrow look right when it hits the enemy. However you are just trying to figure out how to shoot the arrow in the first place? Is that correct?
Millard | 2020-09-27 16:07
Hi, I have created the method of firing the bullet, I just want the bullet to be visible when firing until the bullet hits the target
What kind of node is the target?
Millard | 2020-09-27 16:22
how can the target be a raycast?
Millard | 2020-09-27 16:50
No, RayCast is not the target
ok, but i said, what kind of node is the target and you answered, Node is RayCast.
so why did i get a flag for asking how the target could be a raycast?
Millard | 2020-09-27 17:29
I made a mistake, please help
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.
Millard | 2020-09-28 03:15
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:
$Bulletname.queue_free()
enemy_health = -10
func _on_Area2DBullet_area_entered(area):
if body = enemyname:
enemy == true
Amateur.game.dev. | 2021-01-15 17:55
Did it work?
Amateur.game.dev. | 2021-01-17 21:35