Let's turn this map into a game
Now that we have set up our map, we can finally start coding and re-use the assets we just created. So let's open our app.js
file and remove any existing code in order to have a fresh start.
The scaffolding
As with every Titanium application we have developed so far, we will create a new window with a black background. We also want to interact with this window later down our code, so we will keep its reference in the win
variable:
var win = Ti.UI.createWindow({ backgroundColor: 'black' });
This window will probably be the only Titanium control that we will be using for the whole application. From this point, all the interactions will be done using the game engine. This will allow us to have a more powerful control scheme than native controls such as Button
and TableViews
. On the flip side, it will require us to use a more low-level code. But don't worry, we'll go over it step-by-step.
Now that we have a window to contain our game, our first order of business will...