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.
How to export sprites
-
Hello all,
I am working on a game of Chess for Pythonista. It's come quite far using the scene animations, and I'm currently touching up the validation and beginning an AI. However, I've long been hoping to upload the code, but I've run into the same problem every time -- images. When I started the project I downloaded the sprites and put them in the app, and then I added them to Pythonista's image bank. This is not the method I would like to put users through. So how do I go about saving an image to a file and then exporting it in a way that can be displayed usingscene
? I've seen some scripts that encode it in base 64 but I am not familiar with doing that. -
You might check out
CloudJump2
in theGames
section ofPythonista-Tools
. It has a function calledget_remote_resources()
that downloads images, stores them in local files, and then uses them to animate player death. -
This would be an excellent time for someone to jump in and write a tut for @misha_turnbull on how to create and then maintain a git repo for this new project. The git repo could even be used as the source for the download code @ccc recommends. I would love to see this kind of tutorial done using the latest version of stash. Extra points for including code branching!
@misha_turnbull - as @ccc mentions - the CloudJump2 project has some really nice stuff in support of sprites. It has a sprite class that supports animation using "sprite strips" which allow you to package all your associated sprites in a single image like the frames of a movie. No tools for creating sprite strips, but those will probably come along at some point.
-
@wradcliffe -- I'll make a repo when I have time this weekend (username: 671620616)
@ccc -- I'll check it out, thanks! -
Came up with my own solution after running into some problems with the
get_remote_resources()
method (the zip file kept getting corrupted in the download process): I loaded the images into Pythonista using a computer program called iFunBox and used thescene.load_image_file()
function.In the mean time, I have also completely restarted the project from scratch (but mostly just have the GUI left to do) so it'll be some time before it's uploaded.