Getting started

install the SDK

Make sure you have downloaded and installed the SDK. You will need the ubanita tool to publish and run your project.

create a new project

Create a project named demo.

> ubanita new demo

create the main script

Open the file called main.js paste the following source:

// add a ball of 1 kg
UB.scene.addCircle(0,{
	x: 500, 
	y: 500, 
	radius: 40, 
	
	fill: "#F00", 
	stroke: "#0F0",
	lineWidth: 4,
	
	mass: 1,
	elasticity: 1,
	friction: 1
});

// enable edge input/output
function playerJoined(e) {
	var id = e.data.playerID;
	console.log("playerJoined","id",id);
	UB.controller(id).enableInput("edge");
	UB.player(id).enableOutput("edge");
}

// if a player connects then call playerJoined
UB.game.on("playerJoined",playerJoined);

publish

> ubanita publish

run

> ubanita run

cinema

On your desktop start a internet browser and enter the address of the server.

controller

Get your smartphone, start a internet browser and enter the address of the server. Use the two-fingered touch gesture, called edge, to bounce against the ball.

log

On your desktop start a internet browser and enter the address of the server with /log.