Changing player's x-postition changes y-position

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Skayo
:warning: Old Version Published before Godot 3 was released.

As the title says, I have a strange problem.
Here is my code:

func _process(delta):
# dont ask about this part pls
var player_pos = get_node("player").get_pos()

if (Input.is_action_pressed("player_move_right")):
	player_pos.x += -PLAYER_SPEED * delta

if (Input.is_action_pressed("player_move_left")):
	player_pos.x += PLAYER_SPEED * delta

if (Input.is_action_pressed("player_move_up")):
	player_pos.y += -PLAYER_SPEED * delta

if (Input.is_action_pressed("player_move_down")):
	player_pos.y += PLAYER_SPEED * delta

get_node("player").set_pos(player_pos)

Now, if I press for example the “player_move down key”, the sprite moves to the left.
I would be happy if you could help me.
I know I could just switch the x’s and y’s, but it is strange anyway.

Ok. It seems that this is a bug:
The player was instantiated in the main scene and the control script is attached to the player.
Then I moved the player node with the script directly into the main scene and it worked somehow.

Skayo | 2017-02-01 22:05

Is hard to say what is happening there, more details on the scene structure and what is the “player” will be useful.

eons | 2017-02-02 01:44

It might be happpening because you scaled or rotated the parent of the node you are trying to control, or you assigned wrong keys in the control map. The problem is elsewhere.

Zylann | 2017-02-02 02:25