• Thanks guys, I will study about shader and effect more Thanks!

  • @Tonnoaw I would also try to import game_menu.py and build a menu with title and option selection buttons. So, rather than setting “cheat” mode in the script, define a mode button for a non-programmer to change mode of operation.

  • My current approach is to load the tileset.png which contains all the tiles. I then use Image.crop() for every tile I want to extract. I then upscale them using Image.resize() by some arbitrary factor, because if I would let the scene upscale the 8x8 textures to something like 64x64, the performance drops hard. Using BytesIO I convert them to ui.Image without saving them on disk and from there I can load them as a scene.Texture.

    But thank you for the hint that I can load the image and scale them in one operation!

    All I had to do to fix the original problem was converting the tileset.png to RGB mode.

  • @mikael lol well ive never checked the memory lol so in theory this is what i expect lol

  • @stephen 👍

  • @ccc

    I remember seing this a while back and a couple games became helpful for referencing. but i had to go to other websites and translate what they would say about SceneKit so that it made since for scene. if it wasnt for my previous experience with C# and a few third party engines i would of been completly lost.. I just feel it would be helpfull for current and future Pythonistas to have an isolated source to handle such topic. Game Development has been a wonderfull journey this past 8 years or so but by no means has it been easy lol.

  • @cvp - that’s a tremendous help, many thanks.

    For anyone who might want help with ui and scene path drawing when searching in the future, here’s the complete working code (when using the ‘new’ render loop not the classic render loop):

    import ui from scene import * class MyScene (Scene): def setup(self): self.background_color = '#00006b' self.centre = Point(self.size.w/2, self.size.h/2) def update(self): pass def touch_began(self, touch): # Calculate vector between centre point and touched point dx = touch.location.x - self.centre.x dy = touch.location.y - self.centre.y # Draw path from centre point to touched point path = ui.Path() path.line_width = 4.0 path.move_to(-dx,dy) path.line_to(-dx,dy) path.move_to(0,0) path.line_to(dx,-dy) # Create line node from path line = ShapeNode() line.path = path line.position = (self.centre.x, self.centre.y) line.stroke_color = 'white' self.add_child(line) # Place dots at centre and touch points dotA = Dot(location = self.centre) self.add_child(dotA) dotB = Dot(location = touch.location) self.add_child(dotB) class Dot(ShapeNode): def __init__(self, *, location, **kwargs): circle = ui.Path.oval(0,0,20,20) super().__init__(circle, fill_color='white', **kwargs) self.position = (location.x, location.y) run(MyScene())
  • @SmartGoat, also, I toyed with creating a webview-backed UI framework with a Python API that should have been runnable on most platforms (search for ”youey” here), but of course it is a huge amount of work and has been more or less done before – but those other projects have been abandoned, and none of them worked on Pythonista anyway.

  • @cvp Thanks it worked perfectly! And yeah I realized @JonB, now i can adjust parameters since it works. Thank you both very much :)

  • @ccb_2k18 sorry to answer so late but there is a time zone difference😇
    I've seen you posted the same question in another topic and you are right.
    Don't ask a question to only one person, and surely me, there are in this forum a lot of marvelous people, and often a lot smarter than me.

  • Thanks for this information. Also read about online card generators by CardGenerator official program.

  • @a1ph4b3ta as adviced by @JonB

    import scene from math import pi class Game(scene.Scene): def setup(self): x = 0 while True: if x >= self.size.height: break spike = scene.SpriteNode('plf:Tile_Spikes', position=(x, self.size.height)) spike.anchor_point = (0.5,-1.0) spike.rotation = pi self.add_child(spike) #self.spikes.append(spike) x += 64 scene.run(Game())
  • Thanks, yeah makes sense. I just wondered if there was an 'official' online location, but that will certainly work for what I want.


  • Thank you so much. This is excellent.
    Really appreciate the help and the time you’ve taken to respond.
    Thanks 😄😄

  • @JonB said:

    [1, 2, 3, 4]

    I had a similar problem so I change the a to a tuple and the copied it to b. I needed to pop() from b but keep a unchanged so I can reset it to b at start over in my script

    [1, 2, 3]

  • @Cethric made a full GLKit wrapper, which might do what you want.
    In scene, you will be limited to converting each frame to .jpg by using the SceneView screen capture method, i think, since there is no way to get data out of a shader.

  • I just realised the error. It’s meant to be Rect(self.player.position.x-12, self.player.position.y-12, 24, 24) I forgot the .x on the end of position. Thanks for making me notice it!

  • Thanks, it’s working now!

  • Hi, I agree with @runjaj and understand @ahp378 point of view. I would add:

    have in mind a practical problem to solve with Pythonista (a program to calculate something, or a graphical app with keys and text fields, or a game, ...) divide the practical problem in little problems (if possible) learn to solve the little problems (before independently that is easier and then by linking them together to recreate the main big problem of point 1) by:
    a. searching for an existing piece of code that solves the little problem 'x' (a big database of Pythonista scripts is this by @tdamdouni). if the piece of code solves your problem ok, if not try to modify it by changing numerical values or easy parts (with an empirical approach, and if the piece of code is well commented, it is easier).
    b. if you can't find existing pieces of code, starting to read documentation having in mind that it could be not updated or incomplete (but it is very big).

    The best documentation could be in my opinion a big with easy to find/search feature database of common recipes/pieces of code for all Pythonista features (objc, scene, sound, location, console, etc...). The big database (the one by tdamdouni is an example) would be created and maintained by people with different curiosities and interests, in this way community could help itself about common pieces of code and without bothering the only person who maintains the Pythonista software and its big documentation (@omz).


Internal error.

Oops! Looks like something went wrong!