Swift Sprite System Info

BlitzMax Forums/BlitzMax Programming/Swift Sprite System Info

sswift(Posted 2007) [#1]
How to purchase:

See the Share*It link for prices, purchase through Share*It or Paypal.


"Shareware" license is for amateurs making small freeware or shareware games for sale over the internet.

"Commercial" license is for professionals with a registered business, employees, or who intend to publish their software in stores. Commercial licensees also get better support, and my gratitude. :-)

System information:

Right click to save this, then load it in Blitzmax, and you will see all the functions the system contained as of version 118, with comments describing how to use the system and what all the functions and variables do. Only the code and comments contained inside the functions themselves is missing.


This is a font system which uses the sprite system. It is free for you to use.


It requires a standard graphical font image with the letters centered horizontally in each cell, and roughly centered vertically, but with the bottoms of the letters aligned.

The "character set" should be a list of each letter that is allowed in the font, in the order it appers in the image, including space.

Here is sample code to load a font:

Global Font1:Font

Font1 = Font.Load("gfx\font1.png", 32, 32, "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789?!:-+=/'%;_."+ Chr$(34) + Chr$(126) + "<>,`‘@$^&*|{}[]()" + Chr$(32))

When you create a string of text with this system, you get back a string of text where each letter is an individual sprite, attached to a pivot in the center. (Pivot means any sprite with no image.)

Thus the string of text as a whole and the individual letters in it can be animated just as one would animate any other collection of sprites. Fade the pivot and the text fades. Move the pivot and the text moves. Or tell the individual letters to oscillate up and down in a sine wave with an animation age offset, and the pivot to rise up with increasing speed, and you've got a standard text effect seen in many games.


Here are some demos with source which used an older version of the system. They'll give you a VERY basic idea of what the system can do.

(Ie, display sprites, animate them in motion, and parent one to another and have the size/transparency/position./rotatio/etc of the parent affect the children.)


Here is an old physics demo for the system. There hasn't been a lot of demand for physics in the sprite system, so it hasn't been developed much*, and the code here is out of date as well**.


* Ie, there's still no support for friction, because nobody's ever requested it.

** The physics system has been revamped to make it as easy to apply gravity acceleration to a sprite as it is to animate its position. There is no longer any need to call a seperate animation function for physics, and all the force applying code is part of the main sprite type now just like the animation code. See the 118 version of the code linked above for details.

And finally, here is my Alien Space Beetles game, in progress. Most of the animation you see here is handled by the sprite system. The ship movement and star scroll are handled by manually updating the sprite locations, but the alien attacks are animated with position animations.

Take the part where the alien flies down from the top of the screen and takes up a position on the grid for example. That's done by having a pivot that bounces back and forth on the screen. When I spawn the alien, I attach it to the pivot, and then calculate where the top center of the screen is in pivot space using functions provided by the sprite system for determining this, much like the tformpoint() function in Blitz3D. Then I tell the alien to move from this position in pivot space, to the desired location in pivot space. Now if the pivot weren't moving, this would be a straight line. But because the pivot is moving, the alien ends up flying along a curved trajectory that takes it to the desired point on the "grid". That's the true power of the sprite system right there. Animation and physics combined with the ability to parent obejcts to one another and have the parent properties transferred to the children. (Or not, if desired.)

Notice how objects appear to accelerate or decelerate. That's all done with some simple flags specified for the animations. MODE_SPEEDUP uses a cosine style acceleration. MODE_SPEEDUP_EXP uses an exponential acceleration.

Also the system supports moving objects along paths. Attach to a path, and move the object from X1 to X2 and it follows the path, because it is now in path space. (Y moves perpenduclar to the path at any point.) But that is not demonstrated in the space beetles game yet.


Mouse moves, left mouse fires, right mouse selects weapons, middle mouse spawns enemies. Only laser and missile affect enemies. Spacebar toggles levels, but I think right now it just does the space scroll for all levels.

Glenn Dodd(Posted 2007) [#2]
Do current users of your sprite system get this or do we need to buy again?


Glenn Dodd(Posted 2007) [#3]
Just read your other thread. So this isn't a new version?

sswift(Posted 2007) [#4]
The current version is 118. If anyone has an older version they should email me.

I am emailing out the latest version to everyone now. I have a mailing list setup, why not use it? :-)

Five people's emails bounced immediately. If you bought the system and you don't have the 118 version in your inbox right now, you may be one of them! I will be removing those email addresses from my mailing list. If you didn't get the latest version send me your current email address.

popcade(Posted 2007) [#5]
Got the 118 version, the last version I got previously is 103, tried to fix those old demo to work and at least they all works now.

It seems now sprite system has it's own timing system, imo it's pretty nice and I can pause/slow my game easier.

To be honest, I want friction... :S

Amon(Posted 2007) [#6]
I haven't received it. I can't remember which email addy I used so can you please send all updates from now on to hide_email('amon@kamikazekrow.com') ?

Thanks. :)

[edit] Got it, thanks. :)

tonyg(Posted 2007) [#7]
sswift, I emailed you but have yet to receive anything.

sswift(Posted 2007) [#8]
I got your emails, and I replied to it. You should have gotten the system along with everyone else on the list, but I just sent it again to you just now.

Glenn Dodd(Posted 2007) [#9]
i haven't got an email yet.
glenn @ c2d.co.nz (no spaces)

tonyg(Posted 2007) [#10]
Shawn, still haven't got anything.

sswift(Posted 2007) [#11]
Then tell your ISP to stop blocking my emails! :-)

I'm not even getting BOUNCES back from your ISP. I'll try emailing it from gmail. Maybe they trust them more than comcast.

Gmail email sent!

If you don't get this one, then sign up for a gmail account!

sswift(Posted 2007) [#12]
That would be because last time I went out an update I got a "destination not valid in DNS" error for your email address. I had to use gmail last time. But that's why you're not on the mailing list. I'm emailing from my normal address now, lemme know if it goes through, and if so I'll put you back on the list.

tonyg(Posted 2007) [#13]
Hi Shawn, got it. Not sure why it would be singling you out especially as I have received emails with attachments from you before.

Glenn Dodd(Posted 2007) [#14]
yes thanks i received it fine.
seems the last version i had was 080

SpaceAce(Posted 2007) [#15]
Is this version of the font engine any different from the one I have? If you remember, several months ago, you sent me the font system and I fixed a couple of small bugs in the version you gave me and sent it back to you. That's the version I still have.

By the way, for anyone not using sswift's font code with his sprite engine, you're missing out. The font stuff is fantastic.


sswift(Posted 2007) [#16]
I think this is the same version, with the fixes.

tdman(Posted 2008) [#17]
Hi, Paypal link isn't working. Would prefer to use Paypal over ShareIt.

Could you let me know your Paypal address so I could send payment? Thanks!

sswift(Posted 2008) [#18]

tdman(Posted 2008) [#19]
Payment sent for the shareware version, thanks!