ASPN ActiveState Programmer Network
ActiveState
/ Home / Perl / PHP / Python / Tcl / XSLT /
/ Safari / My ASPN /
Cookbooks | Documentation | Mailing Lists | Modules | News Feeds | Products | User Groups


Recent Messages
List Archives
About the List
List Leaders
Subscription Options

View Subscriptions
Help

View by Topic
ActiveState
.NET Framework
Open Source
Perl
PHP
Python
Tcl
Web Services
XML & XSLT

View by Category
Database
General
SOAP
System Administration
Tools
User Interfaces
Web Programming
XML Programming


MyASPN >> Mail Archive >> pygame-users
pygame-users
Re: [pygame] Animation (Image Strips)
by Andrew Baker other posts by this author
May 20 2006 8:00PM messages near this date
Re: [pygame] Animation (Image Strips) | [pygame] Ridiculously simple way to seperate game-object code
One quick and easy way is to make a strip of alpha color.  Then, split it up
by the width of each frame.  For example, if I have 4 images in an animation
loop, each 64 x 64, I'd need a strip 64 pixels high and 256 pixels wide.
Then, draw a fram of animation in each cel.
When you load in the strip file, you can either slice it up now (I'd suggest
Numeric) and put each slice into a list, or you can use a viewport technique
later.  I'd suggest slicing it now, as I believe it's cheaper on processing
in the long run.  Now, you can on the sprite's update set self.image =
strip[i], where i is the current index.  It's recommended to put a delay of
a few cycles between each increment.

Ta,

-- 
Andrew Ulysses Baker
"failrate"
Thread:
Flameboy9567
Kris Schnee
Andrew Baker

Privacy Policy | Email Opt-out | Feedback | Syndication
© ActiveState Software Inc. All rights reserved