ITGB/Tutorials/SimulatorTest1

From TDN

Image:Alert.png This article or section needs updating.

Parts of this article or section have been identified as out of date.
While the information may be useful, be advised that it may be inaccurate, buggy or erroneous.

Reason: Outdated - iT2D 1.4.1 will have better tutorials

If you are able to revise this information, please do so and remove this 'update' flag when finished.

Contents

Creating the ImageMap

We are going to start by creating imageMaps for our game. ImageMaps are TGB components that keep track of what image to display, and how to display it (size, position, etc).

First, run Torque Game Builder and create a new project. If you do not know how to do this, click here. Name your project TouchGame, do not use a template, and save wherever you wish. For this tutorial, we are using the games folder the SDK installs.

Next, save the following two images to your TouchGame/game/data/images directory:

Image:Button_atom.png
Figure 1

Image:Button_shuriken.png
Figure 2

Once you have the images saved, go back into the TGB Editor. Create imageMaps out of both of the files. If you do not know how to do this, click here. When you have an imageMap for both files, you will want to edit them using the ImageBuilder editor (Shown in Figure 3).

Image:1_ImageBuilder.jpg
Figure 3


In the builder, change the Image Mode to CELL. Your image should be split into sections, which doesn't look right (Shown in Figure 4). Change the Cell Count X value to 2, and the Cell Count Y to 1 (Shown in Figure 5).

Image:2_CellImageMode.jpg
Figure 4

Image:3_ChangeCellCount.jpg
Figure 5


Now, your imageMap will appear as a single image (Shown in Figure 6). You can cycle through the various cells by clicking on the numbers below the image (Shown in Figure 7).

Image:4_Cell1.jpg
Figure 6

Image:5_Cell2.jpg
Figure 7

Editing the Scene

Your next step is to add your images to the scene. The easiest way to do this is to grab an imageMap and drag it to the middle of the editor (Shown in Figure 8). Repeat the step so that both your sprites are visible (Shown in Figure 9)

Image:6_AddImageToScene.jpg
Figure 8

Image:7_FinalScene.jpg
Figure 9

Testing the Game

We need to see how our sprites are going to appear in the game. The easiest way to check is to test our game via TGB. Go ahead and save your level (the default "untitled" is fine). You can then play the scene through the editor. If you do not know how to do this, click here. By running your game in the editor, you can see how everything will look on the iPhone (Shown in Figure 10). This also compiles your DSO files, which is a requirement for testing in the simulator or on an iPhone device.

Image:8_PlayScene.jpg
Figure 10