How do I Multiplayer Drag´n Drop same object ?

1 favourites
  • 5 posts
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • Hi,

    I just have 1 image (sprite) with drag n drop.

    I want the players could move this sprite with mouse, both players. They not gona move at the same time. Its for me and a studant.

    The conection if fine, they both join the room, as Host and as Peer. But only the Host movments are showing to all. Peer can see when Host moves, but when the Peer is the one who drag and drop, nothing happens.

    How can i enable a single object to be "usable" for 2 players at same game?

  • If the object is synced, you won't be able to use the drag and drop behavior on the peer.

    You will need to send the peer input states like mouse position and button states to the host, and the host will have events to move the object based on these inputs.

    After you get that working, you can duplicate the movement events on the peer side and activate local input prediction to hide the lag.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Now i just see the peer movment. Host stop moving.

    I dont know what i should do for both players can move the same sprite.

    Im gona put here some screenshots, maybe someone can easily detect where is the missing key.

  • I realy need some help. Can anyone point me the right direction? I tried everything the tutorials says, and still cannot move a sprite with the mouse, "2 players allowed to move"

    everytime is just host or peer.

  • So first, you need to decide who has priority if suppose BOTH players try to move the sprite at the same time? Where would it go? Let's assume Host has the priority.

    If Host has synced the object, and Peer can see it.

    Then let Peer send Touch.X, Touch.Y to Host

    Store it in an some global or instance variable, peerX and peerY

    Now: if Host touching object: Sprite set position Touch.X, Touch.Y

    Else: if Peer touching object: Sprite set position peerX, peerY

    How will you know if Peer is touching object? and stop touching? You can send some boolean (or number) from Peer to Host (as Message) to tell Host "isTouching" and "stopTouching".

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)