0 votes

Hi! I'm trying to handle point-and-click movement in a multiplayer game. There will only be 2 players in a game, each controlling 3 characters. Is it possible to get the network id of the user who clicks on the tilemap? Based on the network id, I plan on fetching the node by name (which is their own network id), then get the appropriate child character node in order to send the movement instructions to it.

Sample runtime node tree:

root
    gamestate (Node)
    main menu (Control)
    world (Node2D)
        players (Node)
            1294647007 (Node2D)
                character_1 (Sprite)
                character_2 (Sprite)
                character_3 (Sprite)
            1487964002 (Node2D)
                character_4 (Sprite)
                character_5 (Sprite)
                character_6 (Sprite)
        map (Tilemap)

Tilemap script:

extends TileMap
func _input(event):
    if event is InputEventMouseButton and event.is_pressed():
        if event.button_index == BUTTON_LEFT:
            ##click detected on tilemap, but from whom??
            ##handle movement here?

Thank you so much in advance for your help!

asked Apr 20 in Engine by AtlantisXY (14 points)

Why not make the user who clicks the tilemap a remote call and let other players know?

Please log in or register to answer this question.

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.