omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular
    1. Home
    2. WTFruit
    3. Best

    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.


    • Profile
    • Following 0
    • Followers 0
    • Topics 6
    • Posts 26
    • Best 5
    • Controversial 0
    • Groups 0

    Best posts made by WTFruit

    • RE: Instead of a question, I'd like to share my accomplishments

      @chriswilson

      Sorry, it took me a little while and I had to decide how to upload it. It's a handful of scripts and (currently) one asset so it's all in a google drive folder:

      https://drive.google.com/folderview?id=0B5-adIslOLy_QUZsUDRwREhOTkk&usp=sharing

      Just download the entire contents of the folder and keep the structure the same, since the code references the image in the assets folder.

      main.py contains all the scene code, button.py and color.py are a couple things I threw together, and gameobjects.py is for all the gamecode not located in the scenes.

      Let me know if you have any problems!

      EDIT: Some details I forgot!!

      Since I'm doing this in xcode, I modified some settings which might create weird results if you port the code INTO Pythonista... I hid the statusbar, forced landscape orientation, and disabled multi-touch.

      posted in Pythonista
      WTFruit
      WTFruit
    • RE: Woo woo, question number 4! Seems simple.... change a node's (shapenode primarily) size after the fact?

      @Phuket2

      Again, I'm still learning (hence all the questions I keep asking), but I've been basically focusing all my energy on doing stuff with scenes so please feel free to hit me up if you have any questions.

      posted in Pythonista
      WTFruit
      WTFruit
    • RE: Woo woo, question number 4! Seems simple.... change a node's (shapenode primarily) size after the fact?

      @Phuket2 ,

      Since I'm easily the inexperienced one here take what I say with a grain of salt but since I've been staring at the documentation 24/7, I think what you're asking for is explicitly mentioned as a useful possibility. In fact, here it is from the scene module documentation:

      "Integration with the ui Module
      The easiest way to run a scene is to use the run() function, which presents the scene in full-screen. Sometimes this is not what you want, especially if the scene you’re building is not actually a game. For more flexibility, you can also create a SceneView explicitly, set its scene attribute to the scene you want to present, and then add it to a view hierarchy that you created using the ui module.

      You can also use this approach to add traditional UI elements (e.g. text fields) to your game. For this purpose, you don’t have to create a SceneView – you can simply use the view that was created automatically, using your Scene‘s view attribute (this will only work if a scene is already being presented of course).

      The ui module can also be useful for rendering vector images (shapes, text etc.) that you want to use as textures. A Texture can be initialized from a ui.Image for this purpose, typically one that you create using an ui.ImageContext. The ShapeNode and LabelNode classes use this approach to render their content."

      Ignore me if I'm just spouting useless stuff but your comment caught my eye!


      @chriswilson ,

      Interestingly, your example (even with modifications to fit how I write), actually did the job perfectly. I even removed the parentheses from the tuplet (as I've been doing by habit for a little while already) and it still worked.

      Even more interestingly, I tried it in my program one more time and it actually worked this time. Literally the same exact line: self.node.size = w, h. Weird stuff!

      Also, it completely distorted it just like your predicted which means that despite all of this, it will probably be best to redo the path anyway like you said.

      posted in Pythonista
      WTFruit
      WTFruit
    • RE: I'm just trying to learn (re-learn) and I wan't to create a 2-dimensional grid of objects...

      @omz

      You have been more than generous with your time and knowledge and this brief conversation has seriously helped me more than the countless hours of reading and searching that I've been doing so far. After the stuff you just clarified and explained, I've already been able to display the grid in a scene and hook it up to a touch event to re-generate the grid. I could ask more questions but I think they should wait awhile while I poke around more :).

      Thanks,
      Nate

      posted in Pythonista
      WTFruit
      WTFruit
    • I'm just trying to learn (re-learn) and I wan't to create a 2-dimensional grid of objects...

      Hey everyone!

      Long story short, I've dabbled in programming for many many years. I was most proficient with Blitzmax and a BASIC variant for PalmOS back in the day but I was never super serious. For example, I conceptually understand OOP and think it's very logical but in actual practice it used to give me a lot of trouble and I was more comfortable with procedural.

      Anyway, its been years since I've done anything and Pythonista seemed like an attractive way to try to jump back into things (I have a soft spot for mobile platforms). There are very noticeable differences between Python and BASIC, and a lot of other stuff that's very similar overall. But I'm trying to slog through and do different things and there's one that I just can't seem to nail:

      Initially I just wanted to create a grid (2D array, or however you'd prefer to call it) which could store an integer at each gridpoint and could be dynamically sized and created using loops (instead of typing out each list-item by hand). Something that could hypothetically be accessed with something like:

      mygrid [2, 5] = 5
      print mygrid [2, 5]
      

      I actually basically managed to achieve that particular goal using numpy, with the following:

      mygrid = numpy.zeros((heightvariable, widthvariable))
      

      And from there I could change and access the integer using the first bit of code.

      Next I wanted to take it a step further and create a similar grid, but instead of each gridpoint being an integer, I wanted to make each an instance of an object. I haven't had a clue how to do this and tutorials/info online hasn't seemed to help much so I've been trying to do it myself (while trying to get more comfortable with classes). To simplify it I've been starting out with trying to just create one row (list) of object instances and I haven't gotten anything working yet.

      For reference: I'm loosely imagining/shooting for this as being a tilemap for [insert generic game here]. I'll be using the Scene module for output. And I'm looking for just the most barebones way to create a map object and then populate it with tiles which are arranged in rows/columns in a way that they can be individually accessed.

      For additional reference: part of my problem I think has been syntax/code arrangement: I keep bumping into scope and argument issues, which I more or less understand but I'm not always sure how it wants me to resolve them. For example, in the following code:

      class MyScene(scene.Scene):
         themap = Map()
      
      class Map(object):
         #blahblahblah
      

      I get the error 'Map' is not defined (NameError). So I tried creating my map instance in the update() or init() methods of the scene (so that they're created at the start) but when I later tried to USE the map instance, I got the error global name 'mymap' is not defined (NameError). So there's a scope issue where I have no clue where I'm supposed to create it and how I'm supposed to make it accessible at least in the rest of the class.

      I apologize for putting so much in here. I realize it's a lot of basic stuff, I've been trying to read as much as I can but I think I'll find it more helpful being able to have an actual dialog with someone. I appreciate any help anyone can give!

      Cheers,
      Nate

      posted in Pythonista
      WTFruit
      WTFruit