Used the Xcode beta, set the target to iOS 13.3, same issue.
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.
Posts made by Vile
-
RE: Xcode template not working for building to iPhone running iOS 13.3.1
-
Xcode template not working for building to iPhone running iOS 13.3.1
When I try to run the app from my iPhone's home screen, it keeps crashing. I keep getting the following error: 'Thread 1: signal SIGABRT'
Does anyone know how to fix this?
I have selected the deployment target for iOS 13.2 because in the drop down menu none were available for 13.3.1
-
dismissing modal scenes?
Is there a way of selecting which modal scenes I want to dismiss while keeping other modal scenes running? This would be very helpful in game development (for example, you may have two different menus open at the same time, but you only want to close one of them).
-
RE: Sprite animation from sprite sheet at 8 FPS?
@JonB and @cvp, thanks once again! It seems to work in the way I expected now.
It seems that scene.t uses a different time frame from time.process_time, because with the same number value, the animations appear to go at different speeds.
-
RE: Sprite animation from sprite sheet at 8 FPS?
@JonB, I tried using scene.t and scene.dt, but I can’t get it working...
-
RE: Sprite animation from sprite sheet at 8 FPS?
Wait it actually works, I just had the wrong indentation on the update function XD
Here’s the code:
from scene import * import time sprite_sheet = [ Texture('IMG_0227.png').subtexture(Rect(0,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.25,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.5,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.75,0,.25,1)), ] class MyScene (Scene): def setup(self): self.screen="game" self.background_color = 'black' self.last_update = time.process_time() self.sprite = SpriteNode(sprite_sheet[0], scale = 1, position = self.size / 2, parent = self) self.add_child(self.sprite) self.n=0 def update(self): #self.sprite.texture=sprite_sheet[1] current_time = time.process_time() if current_time - self.last_update > 0.05: self.last_update = current_time #modify_the_sprite self.sprite.texture=sprite_sheet[self.n] self.n=self.n+1 if self.n > 3: self.n=0 run(MyScene())
Thanks a lot for your help!
-
RE: Sprite animation from sprite sheet at 8 FPS?
I tried your method, but it seems that anything I put into the update function doesn’t get used...
Here’s the updated code:
from scene import * import time sprite_sheet = [ Texture('IMG_0227.png').subtexture(Rect(0,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.25,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.5,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.75,0,.25,1)), ] class MyScene (Scene): def setup(self): self.screen="game" self.background_color = 'black' self.last_update = time.process_time() self.sprite = SpriteNode(sprite_sheet[0], scale = 1, position = self.size / 2, parent = self) self.add_child(self.sprite) n=0 def update(self): current_time = time.process_time() if current_time - self.last_update > 0.125: self.last_update = current_time #modify_the_sprite self.sprite.texture=sprite_sheet[n] n=n+1 run(MyScene())
-
RE: Sprite animation from sprite sheet at 8 FPS?
@JonB, I’ve also never used Action.wait before, so I’d appreciate an example of this, thanks.
Remember, I’m still a noob here lol
-
RE: Sprite animation from sprite sheet at 8 FPS?
@JonB, I’ve already looked at the game tutorial, where it showed how to animate a walking sequence. However, that method only works when the sprite is changing its position in pixels on the screen, so it will not work for my sprite. This is because my sprite’s position is constantly at the centre of the screen.
The effect I’m trying to achieve is basically a GIF with a customisable frame speed, which is permanently in exactly the same position at the centre of the screen.
-
RE: Sprite animation from sprite sheet at 8 FPS?
@pulbrich, could you give an example of how to check that the correct amount of time has passed?
-
Sprite animation from sprite sheet at 8 FPS?
I have a png file containing 4 frames of a sprite animation sequence, aligned horizontally.
By checking the forum I found out how to display each frame separately from the same image, by using subtexture(rect), so this isn’t the problem here.
I want to run a loop during the game screen, which iterates through each frame in the list of image textures taken from the sprite sheet, every 0.125 seconds, so that the sprite is animated at 8 frames per second. This should not prevent other parts of the program from running at the default 60 FPS.
I do not want to use any functions which pause the entire program, especially not the sleep function from the time module! This is because the sleep function pauses my program and makes everything stop working every few seconds, which is annoying and pointless.
My sprite’s position is constantly at the centre of the screen, so animation by number of pixels moved (like in the Tutorial Part 3 file in the Game Tutorial folder) will not help.
Here is my code so far:
from scene import * sprite_sheet = [ Texture('IMG_0227.png').subtexture(Rect(0,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.25,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.5,0,0.25,1)), Texture('IMG_0227.png').subtexture(Rect(0.75,0,.25,1)), ] class MyScene (Scene): def setup(self): self.screen="game" self.background_color = 'black' self.sprite = SpriteNode(sprite_sheet[0], scale = 1, position = self.size / 2, parent = self) self.add_child(self.sprite) n=0 for sprite in sprite_sheet: #i want this to loop infinitely but only during the game screen. i don't want to use while because it crashes the app, probably because the images keep loading and appearing infinitely? self.sprite.texture = sprite_sheet[n] #my attempt at iterating through the list of sprite frames. n=n+1 '''wait 0.125 seconds to make sprite change image at 8 frames per second, to make an animation''' run(MyScene())
I would appreciate any help, since this is a key part of making a game with working animations.
-
RE: Clear pixel art with FILTERING_NEAREST?
@cvp, I edited your code slightly because python was expecting a Node object:
import scene from scene import * x,y=get_screen_size() class MyScene(Scene): def MyTexture(self,image): texture = Texture(image) texture.filtering_mode=FILTERING_NEAREST return texture def setup(self): self.background_color = '#000000' self.pixel = self.MyTexture('pzl:Blue6') self.pixelNode = SpriteNode(self.pixel) self.pixelNode.position = (x/2,y/2) self.add_child(self.pixelNode) run(MyScene())
-
RE: Clear pixel art with FILTERING_NEAREST?
@mikael, thanks for your help!
Although making a function is longer than one line, this should cut down my production time in the long run.
-
Clear pixel art with FILTERING_NEAREST?
Recently I’ve been testing out my 64*64 pixel art with the pythonista scene module (which I’m more comfortable using).
I have been able to get clear images by individually setting the filtering mode of each imported image to FILTERING_NEAREST, which is a very tedious process.
Is there a way of setting the filtering mode of all the images in the whole scene to FILTERING_NEAREST, preferably in one line?
Here’s a short example of my current code:
import scene from scene import * x,y = get_screen_size() class MyScene(Scene): def setup(self): self.background_color = '#000000' self.pixel = Texture('GameAssets/lizard_profile.png') self.pixel.filtering_mode=FILTERING_NEAREST #imagine copying this for every image. very tedious. but it is the only method that i know which actually works. self.pixelNode = SpriteNode(self.pixel) self.pixelNode.position = (x/2,y/2) self.pixelNode.size = self.pixelNode.size*6 #makes the 64*64 pixel art more visible. self.add_child(self.pixelNode) def update(self): filtering_mode=FILTERING_NEAREST #this does not work. scene.filtering_mode=FILTERING_NEAREST #this also does not work. scene.run(MyScene(),orientation=LANDSCAPE,frame_interval=1, anti_alias=False, show_fps=True, multi_touch=True)
If there are no convenient methods for doing this, I’ll have to rescale my images at a higher resolution (although I’d prefer to stick with 64*64 PNGs due to the smaller file sizes).
-
RE: Basic Pythonista Scene Button?
@JonB, thanks for the example!
However, I plan on using the buttons in a game, and I don’t think that the ui module is good for that.
This is because in all the ui examples I’ve seen, there’s an annoying white bar at the top of the screen with an X on it.
In contrast, when I set a background colour in the scene module, it looks neat and covers the whole screen.
Is there a way of getting rid of the white thing when using the ui module? I don’t think it’s artistically appropriate for games.
-
RE: Basic Pythonista Scene Button?
@mikael, could you give an example of using the ui module to make 4 buttons, which each play a different sound, in 4 different corners of the screen?
Rather than making a canvas, I’d like to use the size of the screen: x/4,y/4 to position the bottom left button, for example, and x/4,y/4*3 for the top left, etc, because I don’t want to have to make custom adjustments for different device screen sizes and ratios.
-
RE: Basic Pythonista Scene Button?
@ccc lol I’m too noob to be a hacker and do weird stuff to URLs so don’t worry (although this is probably what a hacker would say) XD
-
RE: Basic Pythonista Scene Button?
Update: I’ve finally got the button to work!
Basically the issue was, that the touches can only be used on the scene level, so the indentation of the touch functions matter a lot.
The working code is here! :)