[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Managing sprites



So, here is a high-level description of how I am managing sprites in my
Frantic game.   Does this sound like SOP or am I way off in the weeds?   

Each game object (starship, ufo, enemy, powerup, etc.) has a factory or
manager class that is instantiated once in the game_scene object.   It
loads and stores the animation images and sounds for the game object it
creates.   It also has methods to draw, clear, update all sprites it
creates and keeps in a RenderUpdates object.

The sprite objects are created by the manager and contain the logic for
that specific object (mainly movement patterns).   The array of images
is passed by reference to the sprite on creation, and it points to the
correct frame depending on a time-based incremented counter.   

So, the game_scene iterates through the managers, which create objects
(again, time-based), draw, update, and clear them.

I hope this was clear.