This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

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!

in Engine by (12 points)
edited by

Are you running Godot 2.0 or 3.0?

1 Answer

+1 vote

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.

by (22,191 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 Frequently asked questions and 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 [email protected] with your username.