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.


    Adding and Accessing my own assets (sounds, images, etc.)

    Pythonista
    3
    3
    105
    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.
    • Q
      quantumquark last edited by

      How do I add and access my own assets for building a 2D game, rather than using the very nice collection of built in assets?

      JonB bigTanuki 2 Replies Last reply Reply Quote 0
      • JonB
        JonB @quantumquark last edited by

        @quantumquark you can share files from Files, or Workflow app, etc. Then, you can use

        ui.Image.named('full_path_to_file')
        

        You can also use relative paths, but that often confuses people. The current working directory changes when you press "Play", so if you place pngs or jpegs in the same folder as the running script, you can just load the image name, without the full path.

        1 Reply Last reply Reply Quote 0
        • bigTanuki
          bigTanuki @quantumquark last edited by

          @quantumquark If you import an image to the folder where your game script is (or any subfolder), then you should be able to add it as you would the built-in assets. Just tap the plus button and look under files (should be above emojis but may not show until you import an image from your camera roll).

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