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

[pygame] Classless Utilities?



I was just thinking of revising my music/sound functions, which are thin wrappers for Pygame's. One thing that struck me: I'd put most of the code into a JukeBox class, so that to play a sound you'd have to create an instance of it and pass a reference to it to any other object that needed to be able to play sounds. The point of making the class was to centralize the jukebox's data, eg. the set of loaded sounds. Otherwise I'd have bunch of functions and variables lying around in the music file, not linked to a particular object. It seems like the right thing to do, for the sake of having any part of my program able to play sound effects, but kind of inelegant. Thoughts?

Kris