I have a problem with the multiplayer plugin. I'm currently working on an arcade shooter that is supposed to be playable for two.
My problem: The touch control works only for the host. The controller does not work with the peer. Unfortunately, I can not find the error, maybe someone here has a solution.
Thank you for any help.
Example Capx: dropbox.com/s/195esio9sowm8dl/Forumhelp.capx
Develop games in your browser. Powerful, performant & highly capable.
Subevents of event 71:
There you try to work out peer movement by means of the inputs bits determined by peerstate, but the angle you use for directional movement is based on a touch input.
This can not work, as the host does not know where the actual touch is taking place, seeing as the touch is occurring on the peer end.
This results in the peer's angle of movement on the host using several 0 values, making it move towards the top left.
Try and set the X and Y of the peer's touch (upon touch) in a peerstate or send as message to the host, to update it on the host side in a variable on the peer's object in question.
Use those X,Y's in determining the angle of movement.
As a result, for example, action for angle of event 72 could look like:
I noticed a couple more discrepancies in your approach, but the above is most vital and should get you on your way.
The general thought of such mechanics is like:
Peer wants to move, and performs a control action (touch or mouse click) the variables of these (the x and y) need to be conveyed to the host, which then processes the movement with the given variables (the x and y).
And, with position synced objects, the hosts movement of the peers object is then reflected back to the peer automatically.