0 votes

Since few days,

I try to making a simple shooter game with only Visual Scripting.
But after many tries, i can't achieve a basic instancing of my bullet (I use Node 2D).

I use Godot 3.1 (latest version from the official website).

thank you for your help!

in Engine by (15 points)

1 Answer

0 votes
Best answer

Ok so you drag the Bullet.tscn from the Filesystem tab in, which creates a Preload of the bullet.

Then from Available nodes drag in Functions > Call, then set Call Mode to instance, set Base Type to PackedScene, set function to instance.

Connect your preload bullet node to the obj instance node.

Drag the node you wish to add the bullet instance to into your visual script editor from the Scene tab, holding down CTRL.

Get another Call node, this time set Call mode to Instance, Base Type to Node and function to add_child, then connect the Scene node you just added to the obj instance, and connect the return any from PackedScene.Instance() to obj node.

Heres what it should look like.

enter image description here

by (113 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 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 webmaster@godotengine.org with your username.