« Soya/Python base 2 » : différence entre les versions

Contenu supprimé Contenu ajouté
Tavernier (discussion | contributions)
m Soya python base 2 déplacé vers Soya/Python base 2: inclusion dans livre
Seb.bernery (discussion | contributions)
mAucun résumé des modifications
Ligne 55 :
class RotatingBody(soya.Body):
# TheLa MainLoopclasse callsprincipale repeatedlyappelle therépétitivement la méthode advance_time method,pour fortous allles objectobjets indans thela scenescène.
# ToPour maketourner theun body rotateBody, wenous justavons havejuste toà overridemodifier thiscette methodméthode.
# InDans Soya, thel'unité timede unittemps isest thele "roundRound", ;un oneRound roundéquivaut isà 30 millisecondsmillisecondes (defaultpar valuedéfaut).
# The proportionDonc l'argument ofde advance_time isest thela proportion ofde atemps dans un round thatce qui hasproduit occured:
# e.g.par exemple, 0.3 meansfait thatque 30% ofd'un aRound rounds'est haspassé occuredentre since2appels last call, i.e.soit 9 millisecondsmillisecondes.
# advance_time shoulddoit beêtre limitedlimité topour l'animation de code, andmais notpas decisionpour le code de décision. Nous We'llverrons see
# anotherd'autres methodméthodes forpour decisionça stuffdans inBase basic-3.py.
def advance_time(self, proportion):