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.


    Is scene.Node implemented in Xcode App template?

    Pythonista
    node xcode scene
    2
    5
    3794
    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.
    • rstedman
      rstedman last edited by

      I have succesfully managed to create a standalone using the Xcode PythonistaAppTemplate with a fairly simple script. I have another script I wish to turn into an app that uses shapenodes and spritenodes in an animated scene within a custom UI component. However when I run the stand alone version created by Xcode i get the following error:

      'NoneType' object has no attribute 'line_width'

      at the point of insatantiation - None of my nodes seem to work :-( Are nodes implemented in the Xcode template?

      Many thanks for any help.

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

        Iirc, the scene module in the template predates the scene node concept. In pythonista 1.5, scene was more like scene_drawing.

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

          Thanks JonB,

          Can you animate scene_drawings?

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

            look under the docs about the classic render loop -- that should all work. basically, your scene has a draw method there are probably some tutorials over on pythonista-tools.
            see, for example, https://gist.github.com/BashedCrab/9098744
            The docs for the old scene module are here:
            https://web.archive.org/web/20150219144916/http://omz-software.com/pythonista/docs/ios/scene.html
            I think the Layer and Animation classes still exist in the new scene, so you should still be able to test in the app.

            basically, your scene's draw method is called at 60 fps, and there you would implement whatever game logic needs to happen, one frame at a time. usually your "nodes" are just plain objects that implement their own draw /update method, which is called from the scene.draw, and lets the objects update their state, or implement their own internal timing of actions, etc. scene.Layers are sort of like nodes, in that they can be moved around and animated. iirc scene.Animations let you create more complex animation sequences, similar to Actions.

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

              Thank you- that’s very helpful indeed. I will have a go a rewriting using layers and animation.

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