Welcome to my blog. I mainly blog about the basics of running Flash games over the internet, but sometimes I get distracted. Here you will find my efforts at programming turn based Flash games, plus links to all the games I have written. You are free (as in beer) to get all the code, just email me - nicolas_evans at yahoo.com (sorry you cant click on it - I dont want more spam).
Building Multiplayer Games in Flash.
myCommunications.fnMessageSuccess = function () {gotoAndPlay("Player1TestMessageID");} myCommunications.fnMessageFail = function () {trace ("fail activated");gotoAndPlay("Player1End") } myCommunications.fnSendToServer (1) ;Then it tests the message returned is correct.
if (parseInt(myCommunications.gmyLoadVars.messageID) != 1 + myCommunications.gnMessageID) { trace(["MessageID Error", myCommunications.gmyLoadVars.messageID, myCommunications.gnMessageID]) _level0.gotoAndStop("ConnectionError") }Lastly it repeatedly asks the server (every 3 seconds) if the opponent has made his move.
if (parseInt(myCommunications.gmyLoadVars.messageID) != 1 + myCommunications.gnMessageID) { trace(["MessageID Error", myCommunications.gmyLoadVars.messageID, myCommunications.gnMessageID]) _level0.gotoAndStop("ConnectionError") }
myCommunications.fnMessageSuccess = function () { if (parseInt(myCommunications.gmyLoadVars.pno) == 2) { gotoAndPlay("Player1LoopEnd"); } } myCommunications.fnMessageFail = function () {trace ("fail activated");gotoAndPlay("Player1Loop") } myCommunications.fnLoadVariables("?action=VIEW&filename=" + myScrambleGame.gnGameNumber);This concludes the explanation, but if you feel I missed a bit (or a lot) out, please comment or email me. My next task is to convert 3 more games to running over the net, and I will blog if I have any improvements.