Godot script does not work after running the game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By the_priest92

Hello, guys

I am trying to make a simple game but the controls of the game does not start. I folow a tutorial, but in the tutorial everything is OK, but not on my side. I am using Ubuntu 18.06 and this is the code

extends KinematicBody2D

func _ready():
	set_physics_process(true)

func _fixed_process(delta):
	var y = get_pos().y
	var mouse_x = get_viewport().get_mouse_possition().x
	set_pos(Vector2(mouse_x, y))

Thanks in advance!

Are you running Godot 2.0 or 3.0?

SIsilicon | 2018-10-07 03:40

:bust_in_silhouette: Reply From: kidscancode

You didn’t say what was wrong. I notice that position is spelled wrong in get_mouse_position(). Also, are you using Godot 3.0? If so, then this code won’t work because there is no longer a set_pos() function, but instead you use the position property of the object.

If neither of these are the problem, please comment with more information (especially if you have an error message).

Note: I edited your post to fix the code formatting. Please use the code formatting button when posting code so that it is readable.