Shopping Cart (0)

Integrating Objects with the Fantastic Worlds iOS Starter Kit

Quick Integration Tips for Objects / Enemies in the Fantastic Worlds iOS Starter Kit  

Before we get started,  we’ll be using a free program called Tiled to layout the artwork and feed that position data into Xcode. If you’ve used Tiled in the past, forget what you know about it. We will NOT be using sprite sheets or painting tiles (if you’re familiar with that term). We’ll simply be importing one single image, specifying the size, position, and giving it a Name and Type. 

So let’s get started (this should take 5-10 minutes and if you want to skip the step-by-step instructions you can watch a video at the bottom of the page)…


 

1. Drag and drop the .atlas folders into Xcode. Be sure to check Copy Items into Destination Group’s folder (if needed). And be sure Add to Targets has Quest checked on. This will add the Object’s animation sequences as a resource.

Step 1 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

2. The included Property List  will contain dictionaries organized in the same structure as those in the GameData.plist in the Xcode project for the Fantastic Worlds Kit.  Select and copy the entire dictionary in the Objects dictionary (as seen in the screen shot below). You do not need to import the example property list into Xcode, though if its easier to copy and paste that way, go for it. You can just delete it later. In this example, the dictionary is named Mech_Destroyer.

Step 2 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

3. Switch to the GameData.plist. Paste the dictionary into the Objects dictionary in the particular level dictionary you are working on (the example below is in the Jungle level dictionary).

Step 3 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

4. The kit now has the object ready!  Do the same thing for the items in the Weapons dictionary. The Weapons dictionary might use a weapon not included in the kit by default, so if there are images files in the WeaponArt folder (for example, grenade.png and grenade@2x.png)  you can drag and drop those into the Images.xcassets folder. The kit has a bullet and grenade image already set in the Images.xcassets folder, but you can replace those with your own images too.

Step 4 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

5.  Next we just need to define where that object will be in Tiled (available for free at MapEditor.org). Open the .tmx file for the level you are working on (if you need to start a new one from scratch, consult the official documentation for more details). Copy the image in the For_Tiled  folder into the For_Tiled folder of the project you are working on. This image is used for layout only, and will always be an SD (non-Retina image). First we need to drag the image into the Tilesets library. Keep in mind, this is really not a tile set, just an image we are positioning in Tiled.

Step 5 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

6. Next you’ll be prompted to enter the dimensions of the image. Enter the exact size of the SD image (non-Retina image).

Step 6 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

7.  Next in the top bar, select the Insert Tile button. Now select the imported image in the Tilesets window.

Step 7 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

8. Now you can place the image into the scene. If the image isn’t flipped the way you want, or the z position (layering) isn’t perfect, thats okay! Everything will get handled by the data in the GameData.plist in the kit. Tiled is simply used to set a position for the object.

Step 8 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

9. We have one last thing to do in Tiled. So the kit knows how to associate the object in the Property List with the image in Tiled, we need to give it a Name and Type. The Type will be Objects. The Name will match that of the dictionary copied into the Objects dictionary, in the example screenshot below, that is Mech_Destroyer.

Step 9 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

10. Back in Xcode you can now Hit Run! The object will be where you placed it in Tiled. Tweak any properties in the GameData.plist to get the object perfect. Again, Tiled is only used to position the object.

Step 10 - Integrating Objects with the Fantastic Worlds iOS Starter Kit


 

Are you a Udemy teacher? New instructional licenses available!