0 votes

Hi,

I try to instanciate a scene "Bullet.tscn" with this code

extends Area2D

[...]

var bullet_scene = preload("res://Scenes/Bullet.tscn")

func _process(delta):

[...]

# Shoot

if Input.is_action_just_pressed("shoot"):
    var bullet_instance = bullet_scene.instance()
    bullet_instance.positon = $BulletPosition.global_position # the line that break
    get_parent().add_child(bullet_instance)

I use Godot 3.0.6 (mono), the BulletPosition is a Position2D and the scene have a Area2D as root. I read that the problem happen when the scene is not instantiate but I do instantiate it, so i'm a bit lost.

enter image description here

Thank's

in Engine by (17 points)

1 Answer

+2 votes
bullet_instance.positon = $BulletPosition.global_position # the line that break

I think the problem is that you typed "positon" instead of "position".

by (65 points)

Oh my god. How could I not saw that.
Thank's a lot !

I think too much year of Intelisens use make me lost my sight for those detail in new environnement.

I'm ashamed a lot

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.