a quick Xcode/background question
I have a game which I created with Pythonista.
I'd like to pimp it a little by adding a logo and a background.
Where do I put the files in the Xcode project?
How do I access them from the Pythonista script (I got lots of "File not found" errors)?
How do I display the background picture below my root layer?
How do I display my logo above the top layer?
Sorry but this is not in the doc and no example could provide me with an answer.
Pythonista looks for .png photos inside the textures directory.
So, as example, to add a photo called logo.png, you would drag it into the Textures folder (Make sure you drag and drop into xcode's file browser, not finder. Xcode <i>should</i> automatically copy the files appropriately.), and then reference it in your script with the name of 'logo' (<code>self.root_layer.image = 'logo'</code>)
It's best to keep your root layer as the background, so you can call <code>self.root_layer.image = 'yourImageName'</code> in setup to set its background image. If that wont work for your script, then you can make a new layer under the root layer by not adding it to the root layer. Instead, just call <code>self.layerName.draw()</code> (and <code>self.layerName.update(self.dt)</code> if you're using animations on this layer) in your draw function, <i>before</i> root layer's draw, and other images/objects are called.
You can add the logo above the root layer by simply creating it (example, <code>self.logo = Layer(Rect(*self.bounds.center().as_tuple(), 100, 100))</code>) and then adding it to the root layer (<code>self.rootlayer.addlayer(self.logo)</code>)
By default, it is put above the root layer.
I hope this answers your questions!