MCPcopy Create free account
hub / github.com/asweigart/PythonStdioGames / getNextBodyPart

Method getNextBodyPart

src/gamesbyexample/ducklings.py:189–201  ·  view source on GitHub ↗

Calls the appropriate display method for the next body part that needs to be displayed. Sets partToDisplayNext to None when finished.

(self)

Source from the content-addressed store, hash-verified

187 return ' ^ ^ '
188
189 def getNextBodyPart(self):
190 """Calls the appropriate display method for the next body
191 part that needs to be displayed. Sets partToDisplayNext to
192 None when finished."""
193 if self.partToDisplayNext == HEAD:
194 self.partToDisplayNext = BODY
195 return self.getHeadStr()
196 elif self.partToDisplayNext == BODY:
197 self.partToDisplayNext = FEET
198 return self.getBodyStr()
199 elif self.partToDisplayNext == FEET:
200 self.partToDisplayNext = None
201 return self.getFeetStr()
202
203# If this program was run (instead of imported), run the game:
204if __name__ == '__main__':

Callers 1

mainFunction · 0.95

Calls 3

getHeadStrMethod · 0.95
getBodyStrMethod · 0.95
getFeetStrMethod · 0.95

Tested by

no test coverage detected