Nearoo / Wario-Land-3

A remake of the GBC-Game "Wario Land 3" using Pygame for Python
MIT License
51 stars 13 forks source link

Create sound-superclass for sound implementation in the future #2

Open Nearoo opened 9 years ago

Nearoo commented 9 years ago

There's no programming done regarding playing sound. In it's current state, the game needs no sound, but if sound should be needed later down the road, it's better if a dummy-sound-engine is already implemented now.

A draft of how it could work:

class Sound:
    def load_sound(self, filename): # Load sound in advance
    def play_sound(self, filename): # Play sound if already loaded, otherwise load it before
    def stop_sound(self, filename):
    def load_music(self, filename): # Same applies here
    def play_music(self, filename):
    def stop_music(self, filename):
    def queue_music(self, filename):

It then gets passed the same way as Input, World or Graphics. Maybe sounds should even be bound to game-actors, so they can stop sounds they are currently playing... but that's something that can be decided in the future, and be added as a non-standard argument. (e.g. id = id(self))

Nearoo commented 9 years ago

It's actually not that important currently. With the new engine argument in the components, it's very easy to implement it much later, when sound will be actually needed.

snoogans775 commented 7 years ago

It will be straightforward to initiate a streaming music file.

How are collisions handled?

snoogans775 commented 7 years ago

Sorry, I see you clarified the collision handler in another thread.

Nearoo commented 7 years ago

Tell me if you need help.