• stephen

    @Tonnoaw

    How about doing some pre/post gameplay? Such as menus character/player creation player/inventory persistence ect.. while doing this you can figure a goo scaling algorithm to fit your game tonall screens.

    Also avgood time, if you havn't already, to combine scene and ui using a SceneView

    what do you think @mikael

    posted in Pythonista read more
  • stephen

    @cvp

    well look at that... i think its all beena lie... lol jk but i do wonder what the method named might be doing that may be a benefit?

    posted in Pythonista read more
  • stephen

    @cvp said:

    @Moe sure that sprite.png in the same folder as your script? For me, it is ok

    import ui, scene
    image = ui.Image('sprite.png')
    image.show()                                                  # this works
    texture = scene.Texture(image)                # this works
    texture = scene.Texture('sprite.png') # this works
    

    from my understanding shoudn't it be ui.Image.named('sprite.png')

    posted in Pythonista read more
  • stephen

    @Moe @cvp

    You could use io. BytesIO in a Context manager soyou dont need to save and open the images. and when you use ui.Image.from_data(image_data[, scale]) and set scale to your IOS device pixel/point ratio. most comonly 2. (1:1, 2:1, 3:1 ...) this will scale your image properly to the screen. you can get this by calling scene.get_screen_scale()

    heres an example:

    import scene
    import Image
    import io
    
    cache = dict({
        "img1":"./image1.png",
        "img2":"./image2.png",
    })
    
    for k,v in cache.items():
        with Image.open(v) as img:
            resized_img=img.resize(
                (int(img.size[0]/2), int(img.size[1]/2)), Image.ANTIALIAS)
                
            with io.BytesIO() as byteStream:
                resized_img.save(byteStream, "tiff")    
                ns.cache[k]=scene.Texture(ui.Image.from_data(byteStream.getvalue(), scene.get_screen_scale()))
    
    

    posted in Pythonista read more
  • stephen

    @Tonnoaw

    Docs said:

    Note that Scene is a subclass of EffectNode, so you can use a custom Shader for full-scene post-processing effects. Unlike a vanilla EffectNode however, a scene’s effects_enabled attribute is set to False by default.

    posted in Pythonista read more
  • stephen

    @OkieWolf said:

    def button3_tapped(sender):
    sidea = float(v['textfield3'].text)I
    sideb = float(v['textfield4'].text)
    sidec = float(v['textfield5'].text)
    if sidea is not None and sideb is not None
    sidec = sidea + sideb
    v['label1'].text = 'sidec = ' + str(sidec)

    def button3_tapped(sender):
        sidea = float(v['textfield3'].text)I # <= remove "I" typo
        sideb = float(v['textfield4'].text)
        sidec = float(v['textfield5'].text)
        
        # checking if not None 
        if sidea and sideb: # <= you forgot your ":" statment closing
            sidec = sidea + sideb
            v['label1'].text = f'sidec = {sidec}' # changed to fstring 
    
    

    Also remember to use code format on posts 😀 thnk you!

    ```

    posted in Pythonista read more
  • stephen

    @Bumbo-Cactoni said:

    I have noticed a slight error in the game. Occasionally, I will be playing the game, and face a solid wall of gray asteroids. How do I avoid the wall? I can’t. Please, fix this?

    There should always be a gap. What I think is happening here is the gap is being placed above the View Frame and we just cannot see it. I ran some test after changing the following inside Brush class

    
    def __init__(self, game):
            self.game=game
            self.crateMin=200
            self.crateMax=780
            self.gaps=list()
            self.gapSize=4
            self.gapMin=4
            self.gapMax=6
            self.gameObjects=self.game.gameObjects
            self.startPos=Point(Screen.Width()+128, self.gameObjects.Floor)
            self.ShieldBoost()
    
    

    i did not see this happen again but there could still be a chance somehow. all you need to do is limit the hieght for spawning the objects. you could also do a last check to insure there is a gap pressent before returning.

    posted in Pythonista read more
  • stephen

    @Karina

    Very well done!

    posted in Pythonista read more
  • stephen

    @Bumbo-Cactoni said:

    Currently, I’m trying to set up an alarm, but I don’t know like any built-in sounds with the sound module. Please help?

    Example:

    import sound
    
    effect=sound.play_effect('arcade:Powerup_3')
    

    posted in Pythonista read more
  • stephen

    As you said there is just omz but all of us here on the forum help him out. Pythonista just received a really big update recently and from my understanding he is already working on the next one.

    posted in Pythonista read more

Internal error.

Oops! Looks like something went wrong!