omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    a quick Xcode/background question

    Pythonista
    2
    2
    1309
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • mirko
      mirko last edited by

      Hello,

      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.

      1 Reply Last reply Reply Quote 0
      • skehmatics
        skehmatics last edited by

        Hi mirko,

        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!

        ~skehmatics

        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors