0 votes

Hi, first of all I'm sorry I'm asking so many questions, I will re-pay when I'll be more expert and able to aswer some questions myself (or supporting the engine on patreon). I want to make my player to shoot fireballs.

My fireball script:

    extends Area2D

const SPEED = 2
var velocity = Vector2()

func _ready():

func _physics_process(delta):
    velocity.x = SPEED + delta

func _on_VisibilityNotifier2D_screen_exited():

And I've added that to my player script:

const fireballl = preload("res://Fireballl.tscn")


if Input.is_action_just_pressed("ui_focus_next"):
        var fireball = fireballl.instance()   #ERROR HERE
        fireball.position = $Position2D.global_position

Then I've added a "position 2d" to the player, so I could set the start position of the fireball from the player

The error is: " Invalid call. Nonexistent function 'istance' in base 'PackedScene' "

in Engine by (55 points)
edited by

2 Answers

+1 vote
Best answer

That should be instance() not istance() (note, you're missing an n)

by (16,852 points)
selected by

Thanks! I will add some info for who want to do the same, so this post won't be that useless :/

0 votes

fireballl constant that you made should be an onready variable like this

onready var fireballl = preload("res://Fireballl.tscn")

by (27 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.