The Polo window
Implementing a reverse approach to the Marco Polo concept, we will first give our players the ability to provide information about their position to other players using the cloud. This approach makes sense because there is a little chance of getting the other player's location if no one shares it first.
The user interface
We will edit our PoloWindow.js
file and add the following code right after where we created our window. We will begin by adding a new label at the top:
self.add(Ti.UI.createLabel({ top: 17, width: '80%', height: Ti.UI.SIZE, color: '#000', text: 'Enter your name' }));
We will then create a text field that will require our players to enter their name. It will span 80 percent of the screen's width, having a solid border with rounded corners. For its value, we will rely on a property named PLAYER_NAME
so that it persists even when the player quits the application. If this is the first time the application is started (meaning there is no property saved...