Player.IO is the next version of the Nonoba Developer Tools.

More Features, No Branding, Integrates with Everything. Read more »

Nonoba Multiplayer API: Clientside

The clientside is the part the users download to their computer. When making games using the Nonoba Multiplayer API the client side is simply your flash file. Note here that Nonoba does not support uploading of external files for your games, so its important that you embed all the resources required for your game to run into the flash file.

To turn your flash game into a multiplayer game you need to import the Nonoba classes that make up the clientside API, and call an init method in the constructor of your main game class. It is very important that the API is initialized before anything else. Here's a sample class for a multiplayer game:

package {
	import flash.display.MovieClip
	import flash.events.Event
	import Nonoba.api.*
	public class MyGame extends MovieClip{
		private var connection:Connection
		function MyGame(){
			stop();
			connection = NonobaAPI.MakeMultiplayer(stage);
			connection.addEventListener(MessageEvent.MESSAGE, onMessage);
			connection.addEventListener(ConnectionEvent.DISCONNECT, function(e){
				gotoAndStop("error");
			})
			connection.Send("hello");
		}
		
		private function onMessage(e:Object){
			var message:Object = e.message;
			switch(message.Type){
				case "hi":{
					trace("Got response from server on hello message");
					break;
				}
				case "welcometogame":{
					trace("Got welcome! - There are " + message.GetInt(0) + " other users in the game");
					break;
				}
				default:{
					trace("Got unhandled message > " + message);
				}
			}
		}
	}	
}

Mainsini

mainsini.com adalah situs game indie dimana anda bisa bermain game secara single ataupun multiplayer dengan gratis.

Tools untuk Developer

Jika anda adalah game developer flash, kami punya tools istimewa yang bisa membantu anda membuat game yang lebih keren.

Game Keren

Mainkan game flash online terbaik kami, Sepenuhnya gratis. Tunggu apa lagi?

Copyright ©2007-2012 Mainsini™ - All rights reserved.15.6ms on SERVER34096