0 votes

So, in my game, I have a player with an attack in which it uses a tween node to tween a projectile to a fixed position in the air, and then after that it will use tween to shoot the projectile at an enemy's position. It will reach said fixed position fine, but when it's supposed to tween to the enemy's position, it won't reach the enemy. It also keeps going down until it's off the screen, which I presume is why it doesn't reach the correct x position when it's on screen, but since the enemy is obviously high enough to be on screen, it's going lower than the enemy's actual y position. Does anyone know why it goes lower than the enemy's y position? For reference, here's the code:

var tween: Tween = player.get_node("Tween")
tween.interpolate_property(beam_node, "position", Vector2(50, 0), Vector2(200, -250), 1)
tween.start()
yield(tween, "tween_completed")
yield(get_tree().create_timer(1), "timeout")
tween.interpolate_property(beam_node, "position", null, enemy.get_position(), 2)
tween.start()
in Engine by (66 points)

1 Answer

0 votes

Okay, so, looking into it, I think it was just an issue with position being perceived differently as a child of the player node because children of the player node perceive the player's position as 0, 0, or something like that, I just set the tween to tween to the enemy's x position and a y position of 0.

by (66 points)
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.
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 webmaster@godotengine.org with your username.