How to export sprites
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 using
scene? I've seen some scripts that encode it in base 64 but I am not familiar with doing that.
ccc last edited by
You might check out
Pythonista-Tools. It has a function called
get_remote_resources()that downloads images, stores them in local files, and then uses them to animate player death.
wradcliffe last edited by
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.
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 the
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.