0 votes

Hi!

I want to drag a member from members menu to Resource Path, and be able to preload it just like below:

extends Node

export (PackedScene) var wp

func _input(event):
    if event.is_action_pressed("click"):
        var new_wp = wp.instance()
        new_wp.position = get_viewport().get_mouse_position()
        add_child(new_wp)

Thanks

asked Jun 4, 2019 in Engine by Okan Ozdemir (193 points)

1 Answer

+1 vote
Best answer

I'm not sure I completely understand your question. I created a custom scene which is just a Label, saved it. I then created an export var called customlabel and dragged that scene into it. Then i created the visual script and looked for mousedown action, upon which I would place an instance of the custom label at the position of the mouse click on the screen. See the screenshot below:

enter image description here

answered Jun 7, 2019 by vic.the.developer (112 points)
selected Jun 9, 2019 by Okan Ozdemir

Hi!

That is great, I will try, and also try that with get touch for android possible. Will test and share! Thanks

Thanks again

What do you mean by mouse_down (action)? I add it in editor but it has no use.

Thanks

Project > Project Settings > Input Map -> Action -> type in name mousedown, hit Add
Now click the + next to the new entry in the list mouse
down, Select Mouse Button, choose the button you want, then click Add.

Thanks vic.the.developer! You are great at visual scripting!

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.