Could someone please post a little working example of how to submit a move in Corona cloud multiplayer game. I am really struggling to wrap my head around it!
Thanks,
Gooner87
Could someone please post a little working example of how to submit a move in Corona cloud multiplayer game. I am really struggling to wrap my head around it!
Thanks,
Gooner87
Hopefully I can help, this works for me.
Sending ( This goes in the “newMatch” part of my multiplayerListener )
local params = { moveContent = "this is a test message to see if you can recieve.", userAlert = "alert message" } match:submitMove( params )
Receiving ( This goes in my multiplayerListener )
if ( event.type == "getRecentMoves" ) then local moveContent = event.response local userAlert = event.response[1].user\_alert local textpiece = display.newText( moveContent[1].content, 480, 320, native.systemFont, 64 ) end
Right now, it sends the statement out to all the users the matchmaker picks. It will eventually hold the random seed used to generate the random platformer levels. Hopefully this helps you, make sure you don’t have any errors in the console. You might need to add a json.decode around the event.response if your message is encoded.
Thanks soccerlax,
I got it working eventually, I was sending an encoded table for moveContent and wasn’t decoding it properly. All good now though
Hopefully I can help, this works for me.
Sending ( This goes in the “newMatch” part of my multiplayerListener )
local params = { moveContent = "this is a test message to see if you can recieve.", userAlert = "alert message" } match:submitMove( params )
Receiving ( This goes in my multiplayerListener )
if ( event.type == "getRecentMoves" ) then local moveContent = event.response local userAlert = event.response[1].user\_alert local textpiece = display.newText( moveContent[1].content, 480, 320, native.systemFont, 64 ) end
Right now, it sends the statement out to all the users the matchmaker picks. It will eventually hold the random seed used to generate the random platformer levels. Hopefully this helps you, make sure you don’t have any errors in the console. You might need to add a json.decode around the event.response if your message is encoded.
Thanks soccerlax,
I got it working eventually, I was sending an encoded table for moveContent and wasn’t decoding it properly. All good now though