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!

asked Nov 24, 2019 in Projects by doubtseverywhere (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.

answered Nov 24, 2019 by kidscancode (17,714 points)
selected Dec 11, 2019 by doubtseverywhere
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.