0 votes

Hello everyone,

I'm super new to Godot and I'm trying to follow a simple tutorial on YouTube. Since the tutorial is from Godot 2.0 and I'm using the recent version I'm having some issues.

The error message is as follows:
"Invalid call to function 'set_position' in base 'Sprite (flare.gd)'. Expected 1 arguments."

My laser script:
enter image description here

My flare script:enter image description here

Please help me!

in Engine by (21 points)

1 Answer

+1 vote
Best answer

First of all, why not use a tutorial that's made for the version you're using?

Using code from pre-3.0 requires many changes. As a beginner, you're not going to know how to make those changes.

For example, the position property is a Vector2. That means that set_position() takes one argument, a vector, not two, which is what you've written: set_position(get_position().x, get_position().y).

That code could read


But post Godot-3.0 direct property access was added (and greatly simplifies code), so you'd write

flare.position = position

Again, I'd strongly advise avoiding outdated tutorials when you're trying to learn the engine. There will be many things you just wind up learning to do the wrong way.

by (21,932 points)
selected by
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.