@@ -145,6 +145,7 @@ def collide(ax0, ay0, ax1, ay1, bx0, by0, bx1=None, by1=None):
145145
146146
147147class Audio :
148+ """Play sounds."""
148149 last_audio = None
149150
150151 def __init__ (self , speaker_pin , mute_pin = None ):
@@ -156,14 +157,21 @@ def __init__(self, speaker_pin, mute_pin=None):
156157 self .audio = audioio .AudioOut (speaker_pin )
157158
158159 def play (self , audio_file , loop = False ):
160+ """
161+ Start playing an open file ``audio_file``. If ``loop`` is ``True``,
162+ repeat until stopped. This function doesn't block, the sound is
163+ played in the background.
164+ """
159165 self .stop ()
160166 wave = audioio .WaveFile (audio_file )
161167 self .audio .play (wave , loop = loop )
162168
163169 def stop (self ):
170+ """Stop playing whatever sound is playing."""
164171 self .audio .stop ()
165172
166173 def mute (self , value = True ):
174+ """Enable or disable all sounds."""
167175 if self .mute_pin :
168176 self .mute_pin .value = not value
169177
@@ -289,7 +297,8 @@ def move(self, x, y, z=None):
289297class WallGrid (Grid ):
290298 """
291299 A special grid, shifted from its parents by half a tile, useful for making
292- nice-looking corners of walls and similar structures."""
300+ nice-looking corners of walls and similar structures.
301+ """
293302
294303 def __init__ (self , grid , walls , bank , palette = None ):
295304 super ().__init__ (bank , grid .width + 1 , grid .height + 1 , palette )
@@ -341,7 +350,14 @@ def move(self, x, y, z=None):
341350 self .layer .move (int (x ), int (y ))
342351
343352 def set_frame (self , frame = None , rotation = None ):
344- """Set the current graphic and rotation of the sprite."""
353+ """
354+ Set the current graphic and rotation of the sprite.
355+
356+ The possible values for rotation are: 0 - none, 1 - 90° clockwise,
357+ 2 - 180°, 3 - 90° counter-clockwise, 4 - mirrored, 5 - 90° clockwise
358+ and mirrored, 6 - 180° and mirrored, 7 - 90° counter-clockwise and
359+ mirrored.
360+ """
345361
346362 if frame is not None :
347363 self .frame = frame
0 commit comments