0 votes

Hey, I'm trying to get my script to print the player's position each time it clicks but it just keeps printing the same initial position

onready var PlayerMan = get_parent().get_node("Player").position

func _input(event):
if event.is_action_pressed('Fire'):
    PlayerMan = get_parent().get_node("Player").position
    target_position = PlayerMan
in Engine by (31 points)

Are you changing the Player.position in your Player's script?

All you're doing is printing the Player node's position in that code excerpt, if Player.position is not updated elsewhere, it's working as written.

1 Answer

0 votes

You either need to use getglobalposition() if your player is a KinematicBody and you are not changing its position directly (e.g using moveandslide()) or maybe you are not moving your player at all as @timothybrentwood says.

by (1,065 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.