Drag and drop / movment in a board game

anubarakdesuanubarakdesu Posts: 2Member

Hello, thanks in advice.
I'm trying to make a simple board game and don't understand the "drag and drop" methods(I use GDscript).
I need take a game piece and move it to other control node. It can be made taking the sprite and when the player drop it, the sprite is now child to another control node, at finish is need flush the other sprite, but i'm trying this 3 days ago and the tutorials do not have the same objective, "Drag and drop (GUI)" tutorial have the base of my concept, but i can't make it work.
all help and links are welcome, sorry for bad English

Tagged:

Tags :

Answers

  • Shin-NiLShin-NiL Posts: 150Moderator

    Did you see the drag and drop official demo?

  • anubarakdesuanubarakdesu Posts: 2Member

    yes, I find how to do it without drag and drop, and why tile grid is it the best way to do a table game, this project explains all about tile movement, thanks
    https://github.com/GDquest/Godot-engine-tutorial-demos/tree/master/2017/final/09-Isometric grid-based movement

  • bryliebrylie Posts: 2Member
    edited March 31

    @Shin-NiL said:
    Did you see the drag and drop official demo?

    I have found the drag and drop demo, and am trying to figure out how it works by experimentation.

    It would still be useful to have a tutorial that explains what the functions do and how they are related. E.g. in a scene where I have a game piece and a drop target, which functions do I define for each of the components and how do they pass data. Are there any other functions related to drag and drop than the following?

    • get_drag_data
    • set_drag_preview
    • drop_data
    • can_drop_data
  • bryliebrylie Posts: 2Member
    Answer ✓

    The basic idea is to have a GamePiece node that has a texture and can be moved around by dragging and dropping. There should also be one or more game board Positions onto which the GamePiece can be dropped. If the Position is empty, the GamePiece can be dropped, but otherwise it must be dropped elsewhere.

    What types of nodes should be used for the GamePiece and Position scenes (two Control nodes)? When moving the GamePiece, how can it be set to follow the mouse, rather than being stationary at the original position?

Sign In or Register to comment.