Multiplayer help movement!

I’m making a 2 player mobile game with people choosing a character and then fighting and I solved the character choosing problem however then I ran into a problem with the characters both moving if one of them press the movement keys and I was trying to figure out a way to fix that! Any help will be appreciated.

1 Like

Is the game based on two players fighting using the same mobile device?

No it’s suppose to be for 2 people using different devices.

1 Like

I don’t think that’ll be possible without an indie account.

Could you be able to why it won’t be able to do it without an indie account

1 Like

If you’re quick, you could probably get away with finishing it with a one-month subscription, but indie is just awesome, and one year is discounted.

I could help you with some multiplayer movement if you do. I have some multiplayer projects myself.

Would you be able to show an example please :blush:

1 Like

Well, it’s private, but I have some code I could share. Gimme a sec…


It’s a lot like just normal movement. The other player’s device should update the inputs coming through on their side. If I didn’t understand your problem, please explain again what you wanted me to help with.

Also, ignore the stuff in the upper left, that’s specifically for the game.

Since our game is a mobile game we have to use buttons on screen to make our characters move however, when 1 player touches the movement button both of their characters move instead of only one of them moving.

1 Like

Ohh, sorry. Ok, in that case the inputs will have to be modified. Is your game top-down or platformer?

There are a few ways to make mobile controls without indie, but I again, would recommend indie for the added behaviors indie provides for mobile games.
Here are a few mobile touchpad examples without using indie.
D-Pad 8 Direction. - Flowlab Game Creator
JoyStick - Flowlab Game Creator

My game is a platformer

1 Like

Ok, I found an examples:

Note, very basic, but it contains platformer mobile controls.
Basically, you want a set of buttons that, if the player touches them, (if using free, then mouseclick will output on mobile fine), then it sends the basic output to start the movement cycle.

I can whip up an example if this doesn’t work well.

2 Likes

I have the movement down I just need to figure out how to make it so that when 1 player presses the button to move it only moves there character instead of both. Since mines a multiplayer game whenever they try to press the movement key it just moves both characters

2 Likes

I have something that will do just that. please check back in just a minute

@Dyso_Ico here is the code please follow instructions

Player 1 code

PASTE THIS IS PLAYER 1 OBJECT!

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Run & Jump Player 1","behaviorType":"logic.NodeGroup","x":-270,"y":-80,"group":0,"id":"72398a5be75cb241","notes":null,"n_o":0,"isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-32,"group":"72398a5be75cb241","id":"72398a5c44811b42","startVal":-6,"tag":"move left"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":360,"y":96,"group":"72398a5be75cb241","id":"72398a5cd9922a49"},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":360,"y":-32,"group":"72398a5be75cb241","id":"72398a5df248bd4a","vertical":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":96,"group":"72398a5be75cb241","id":"72398a5d23e56a4c","startVal":6,"tag":"move right"},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":288,"group":"72398a5be75cb241","id":"72398a5d1b816c46","keyCode":38,"repeats":false,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":96,"group":"72398a5be75cb241","id":"72398a5d20080f41","keyCode":39,"repeats":true,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":-48,"group":"72398a5be75cb241","id":"72398a5d5182b94d","keyCode":37,"repeats":true,"delay":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":320,"group":"72398a5be75cb241","id":"72398a5ec494d541","startVal":12,"tag":"jump force"},{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":180,"y":224,"group":"72398a5be75cb241","id":"72398a5ecbf54f4f","targetClassId":0,"targetEntityId":0,"collisionFilter":15,"collideWithEntity":false},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":224,"group":"72398a5be75cb241","id":"72398a5ed904a840","_startVal":0,"dataType":2},{"inputCount":3,"outputCount":3,"name":"Impulse","behaviorType":"logic.components.Impulse","x":540,"y":224,"group":"72398a5be75cb241","id":"72398a5eb5c6c544"},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-450,"y":-192,"group":"72398a5be75cb241","id":"7239d4db1d47d941","tag":"Player 1:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Object Variable","behaviorType":"logic.properties.CustomProperty","x":-270,"y":-192,"group":"72398a5be75cb241","id":"7239f526c2558449","tag":"Player 1:Number"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":-48,"group":"72398a5be75cb241","id":"723a67eec22b734d"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":112,"group":"72398a5be75cb241","id":"723a6cc31c337846"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":304,"group":"72398a5be75cb241","id":"723a71af3b6b8744"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":-48,"group":"72398a5be75cb241","id":"723aa4a8310bf740"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":96,"group":"72398a5be75cb241","id":"723ac73d42b34249"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":272,"group":"72398a5be75cb241","id":"723af301c42af543"},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-450,"y":-288,"group":"72398a5be75cb241","id":"723b2645babd0b43"}],"links":[{"input_id":"72398a5df248bd4ai0","output_id":"72398a5c44811b42o0"},{"input_id":"72398a5cd9922a49i0","output_id":"72398a5c44811b42o0"},{"input_id":"72398a5df248bd4ai1","output_id":"72398a5d23e56a4co0"},{"input_id":"72398a5cd9922a49i0","output_id":"72398a5d23e56a4co0"},{"input_id":"723a71af3b6b8744i0","output_id":"72398a5d1b816c46o0"},{"input_id":"723a6cc31c337846i0","output_id":"72398a5d20080f41o0"},{"input_id":"723a67eec22b734di0","output_id":"72398a5d5182b94do0"},{"input_id":"72398a5ed904a840i2","output_id":"72398a5ec494d541o0"},{"input_id":"72398a5ed904a840i1","output_id":"72398a5ecbf54f4fo0"},{"input_id":"72398a5ed904a840i0","output_id":"72398a5ed904a840o0"},{"input_id":"72398a5eb5c6c544i1","output_id":"72398a5ed904a840o0"},{"input_id":"7239f526c2558449i0","output_id":"7239d4db1d47d941o0"},{"input_id":"723aa4a8310bf740i0","output_id":"7239f526c2558449o0"},{"input_id":"723ac73d42b34249i0","output_id":"7239f526c2558449o0"},{"input_id":"723af301c42af543i0","output_id":"7239f526c2558449o0"},{"input_id":"723aa4a8310bf740i1","output_id":"723a67eec22b734do0"},{"input_id":"723ac73d42b34249i1","output_id":"723a6cc31c337846o0"},{"input_id":"723af301c42af543i1","output_id":"723a71af3b6b8744o0"},{"input_id":"72398a5c44811b42i1","output_id":"723aa4a8310bf740o0"},{"input_id":"72398a5d23e56a4ci1","output_id":"723ac73d42b34249o0"},{"input_id":"72398a5ec494d541i1","output_id":"723af301c42af543o0"},{"input_id":"7239f526c2558449i1","output_id":"723b2645babd0b43o0"}]}}}
Player 2 code

PASTE IN PLAYER 2 OBJECT!

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Run & Jump Player 2","behaviorType":"logic.NodeGroup","x":-270,"y":-80,"group":0,"id":"723ba4ab7e78494b","notes":null,"n_o":0,"isMenuItem":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":-32,"group":"723ba4ab7e78494b","id":"723ba4acfd226b47","startVal":-6,"tag":"move left"},{"inputCount":3,"outputCount":3,"name":"Velocity","behaviorType":"logic.properties.Physics","x":360,"y":96,"group":"723ba4ab7e78494b","id":"723ba4ad89be9742"},{"inputCount":3,"outputCount":3,"name":"Flip","behaviorType":"logic.properties.Flip","x":360,"y":-32,"group":"723ba4ab7e78494b","id":"723ba4ad4cd3044d","vertical":false},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":96,"group":"723ba4ab7e78494b","id":"723ba4ae5e6cde42","startVal":6,"tag":"move right"},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":288,"group":"723ba4ab7e78494b","id":"723ba4afa2495c4d","keyCode":38,"repeats":false,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":96,"group":"723ba4ab7e78494b","id":"723ba4af6a3d2c4c","keyCode":39,"repeats":true,"delay":0},{"inputCount":0,"outputCount":2,"name":"Keyboard","behaviorType":"logic.triggers.Keyboard","x":-450,"y":-48,"group":"723ba4ab7e78494b","id":"723ba4afa3a98242","keyCode":37,"repeats":true,"delay":0},{"inputCount":3,"outputCount":1,"name":"Number","behaviorType":"logic.logic.Value","x":180,"y":320,"group":"723ba4ab7e78494b","id":"723ba4afa7791b4c","startVal":12,"tag":"jump force"},{"inputCount":0,"outputCount":1,"name":"Collision","behaviorType":"logic.triggers.Collision","x":180,"y":224,"group":"723ba4ab7e78494b","id":"723ba4b0911f684b","targetClassId":0,"targetEntityId":0,"collisionFilter":15,"collideWithEntity":false},{"inputCount":3,"outputCount":1,"name":"Switch","behaviorType":"logic.logic.Switch","x":360,"y":224,"group":"723ba4ab7e78494b","id":"723ba4b1e3c1494e","_startVal":0,"dataType":2},{"inputCount":3,"outputCount":3,"name":"Impulse","behaviorType":"logic.components.Impulse","x":540,"y":224,"group":"723ba4ab7e78494b","id":"723ba4b14914cf45"},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-450,"y":-192,"group":"723ba4ab7e78494b","id":"723ba4b3987ae242","tag":"Player 2:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Object Variable","behaviorType":"logic.properties.CustomProperty","x":-270,"y":-192,"group":"723ba4ab7e78494b","id":"723ba4b3b7eb6843","tag":"Player 2:Number"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":-48,"group":"723ba4ab7e78494b","id":"723ba4b4ebf65e4a"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":112,"group":"723ba4ab7e78494b","id":"723ba4b402d00b46"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":-270,"y":304,"group":"723ba4ab7e78494b","id":"723ba4b4932e7944"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":-48,"group":"723ba4ab7e78494b","id":"723ba4b426acd943"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":96,"group":"723ba4ab7e78494b","id":"723ba4b446099940"},{"gateVal":0,"mode":"equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":-90,"y":272,"group":"723ba4ab7e78494b","id":"723ba4b4578dfd46"},{"inputCount":0,"outputCount":1,"name":"Always","behaviorType":"logic.triggers.Always","x":-450,"y":-288,"group":"723ba4ab7e78494b","id":"723ba4b562a23d4e"}],"links":[{"input_id":"723ba4ad4cd3044di0","output_id":"723ba4acfd226b47o0"},{"input_id":"723ba4ad89be9742i0","output_id":"723ba4acfd226b47o0"},{"input_id":"723ba4ad4cd3044di1","output_id":"723ba4ae5e6cde42o0"},{"input_id":"723ba4ad89be9742i0","output_id":"723ba4ae5e6cde42o0"},{"input_id":"723ba4b4932e7944i0","output_id":"723ba4afa2495c4do0"},{"input_id":"723ba4b402d00b46i0","output_id":"723ba4af6a3d2c4co0"},{"input_id":"723ba4b4ebf65e4ai0","output_id":"723ba4afa3a98242o0"},{"input_id":"723ba4b1e3c1494ei2","output_id":"723ba4afa7791b4co0"},{"input_id":"723ba4b1e3c1494ei1","output_id":"723ba4b0911f684bo0"},{"input_id":"723ba4b1e3c1494ei0","output_id":"723ba4b1e3c1494eo0"},{"input_id":"723ba4b14914cf45i1","output_id":"723ba4b1e3c1494eo0"},{"input_id":"723ba4b3b7eb6843i0","output_id":"723ba4b3987ae242o0"},{"input_id":"723ba4b426acd943i0","output_id":"723ba4b3b7eb6843o0"},{"input_id":"723ba4b446099940i0","output_id":"723ba4b3b7eb6843o0"},{"input_id":"723ba4b4578dfd46i0","output_id":"723ba4b3b7eb6843o0"},{"input_id":"723ba4b426acd943i1","output_id":"723ba4b4ebf65e4ao0"},{"input_id":"723ba4b446099940i1","output_id":"723ba4b402d00b46o0"},{"input_id":"723ba4b4578dfd46i1","output_id":"723ba4b4932e7944o0"},{"input_id":"723ba4acfd226b47i1","output_id":"723ba4b426acd943o0"},{"input_id":"723ba4ae5e6cde42i1","output_id":"723ba4b446099940o0"},{"input_id":"723ba4afa7791b4ci1","output_id":"723ba4b4578dfd46o0"},{"input_id":"723ba4b3b7eb6843i1","output_id":"723ba4b562a23d4eo0"}]}}}
Other required code

Please read carefully!
You must make another object that will not be deleted and paste this code inside

{"data":{"behavior":{"v":"2","nodes":[{"inputCount":0,"outputCount":0,"name":"Player adders","behaviorType":"logic.NodeGroup","x":0,"y":-48,"group":"","id":"72389bf933419a4d","isMenuItem":false},{"inputCount":0,"outputCount":1,"name":"Player Count","behaviorType":"logic.multiplayer.PlayerCount","x":-270,"y":0,"group":"72389bf933419a4d","id":"72358f3205d21140","levelOnly":false},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-270,"y":-400,"group":"72389bf933419a4d","id":"7235adcf41a6394d","tag":"Player 1:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":-270,"y":-304,"group":"72389bf933419a4d","id":"7235b2c98bfe2549","tag":"Player 2:Number","version":2,"dataType":2},{"gateVal":0,"mode":"not equal to","inputCount":2,"outputCount":2,"name":"Filter","behaviorType":"logic.logic.Filter2","x":90,"y":-16,"group":"72389bf933419a4d","id":"723632bc34b8234b"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":270,"y":80,"group":"72389bf933419a4d","id":"723583a7a532f743"},{"inputCount":3,"outputCount":1,"name":"Object Variable","behaviorType":"logic.properties.CustomProperty","x":-90,"y":-16,"group":"72389bf933419a4d","id":"72367913dcafae40","tag":"Player 1:Number"},{"inputCount":1,"outputCount":2,"name":"User Info","behaviorType":"logic.gameflow.UserInfo","x":270,"y":-80,"group":"72389bf933419a4d","id":"7237d178c8ee8d4f"},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":450,"y":-96,"group":"72389bf933419a4d","id":"7237ebf579ccde4b","tag":"Player 2:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Global","behaviorType":"logic.logic.Global","x":450,"y":64,"group":"72389bf933419a4d","id":"7237f11b1f5a4e4f","tag":"Player 1:Number","version":2,"dataType":2},{"inputCount":3,"outputCount":1,"name":"Object Variable","behaviorType":"logic.properties.CustomProperty","x":-90,"y":-400,"group":"72389bf933419a4d","id":"723858e968564e47","tag":"Player 1:Number"},{"inputCount":3,"outputCount":1,"name":"Object Variable","behaviorType":"logic.properties.CustomProperty","x":-90,"y":-304,"group":"72389bf933419a4d","id":"723874627bf77c46","tag":"Player 2:Number"}],"links":[{"input_id":"72367913dcafae40i1","output_id":"72358f3205d21140o0"},{"input_id":"723858e968564e47i0","output_id":"7235adcf41a6394do0"},{"input_id":"7237d178c8ee8d4fi0","output_id":"723632bc34b8234bo0"},{"input_id":"723583a7a532f743i0","output_id":"723632bc34b8234bo1"},{"input_id":"7237f11b1f5a4e4fi0","output_id":"723583a7a532f743o0"},{"input_id":"723632bc34b8234bi1","output_id":"72367913dcafae40o0"},{"input_id":"7237ebf579ccde4bi0","output_id":"7237d178c8ee8d4fo0"}]}}}

Please let me know if you have any questions or need further help!

Thank you soo much for your help!

2 Likes

You are very welcome. Glad to do it when I can :grin:

1 Like