HELP! New to Godot. Trying to build a Football Manager Sim. How to set up the Drag and Drop list

BlooobirdBlooobird Posts: 2Member

I am very new to coding. I am learning Godot on the fly to build my football manager type sim. The first problem I have come up against is how to set up the Squad Page so that I have a list of players with various stats that I can drag and drop and swap with each other. Any help or advice would be really appreciated!

I have watched various videos on inventories and GUIs but nothing has the functionality I'm looking for. Specifically to be able to pick up a player and drag him so that he can be swapped with another player in the team with all of the underlying data swapping with him.

If anyone has any tips or could perhaps point me in the direction of some videos or tutorials on this I'd be very grateful.

Thanks very much.
JP

Answers

  • TwistedTwiglegTwistedTwigleg Posts: 2,814Admin

    Welcome to the forums @Blooobird!

    Have you see the drag-and-drop GUI demo on the Godot demo repository? It might help show how to achieve the basics of what you are looking for.

  • BlooobirdBlooobird Posts: 2Member

    @TwistedTwigleg said:
    Welcome to the forums @Blooobird!

    Have you see the drag-and-drop GUI demo on the Godot demo repository? It might help show how to achieve the basics of what you are looking for.

    thanks for the welcome.

    I am stuck! I have been playing around with that GUI demo and I thought the hard part was the drag and drop bit but I think I've got my head around that and I can just about get them to swap too (I was pretty chuffed!) but the player stats are written to an array which doesn't update when I move the nodes on screen. argh. So I can't work out how to save them in their new positions.

    any ideas? are there any array tutorials that you know of? they are rock!

  • TwistedTwiglegTwistedTwigleg Posts: 2,814Admin

    Could you potentially iterate through the node tree and update the array that way? Maybe emit a signal to the parent node that has all of the shuffled nodes that tells it to go through the tree and update the array? I don't know how well that might work, but it could be something to try.

Sign In or Register to comment.