Planung Q2:
Weiter an Auftrag von letzter Lektion
Code-Beispiele SuS:
Wo ist das Problem?
class Asteroid: def __init__(self, pos_x, pos_y, brightness, speed, last_update): self.pos_x = pos_x self.pos_y = pos_y self.brightness = brightness self.speed = speed self.last_update = last_update def spawn(self): if len(Asteroids) < MAX_ASTEROIDS: pos_x = random.randint(0, 4) pos_y = 0 brightness = ASTEROID_BRIGHTNESS speed = random.randint(50, 500) last_update = time.ticks_ms() asteroid = Asteroid(pos_x, pos_y, brightness, speed, last_update) Asteroids.append(asteroid) return asteroid return None
if <condition1>: if <condition2>
einfach: if <condition1> and <condition2>
while True
, mit break ausbrechen (Lösung v04a). Problem: Wie auf Starteinstellungen zurücksetzen, ohne den Code copy-pasten? Möglichkeit: global variables, aber ist bad practicemy_file.py
game_over
bool (True oder False), schreibe if game_over
anstelle if game_over == True
time.ticks_ms()
\\ Name | Klasse | Team |
---|---|---|
Kim Ngo (1Mdz, KK) | 1 | 1 |
Enny Reinhardt (2Mdz) | 2 | 1 |
Rico Fleming (1Ma) | 1 | 2 |
Jona Kreis (2Mc) | 2 | 2 |
Maia Cater (1Fa, KC) | 1 | 3 |
Livia Scherle (2Mez) | 2 | 3 |
Jennifer Imonopi (1Mez, KC) | 1 | 4 |
Lea Seitter (1Mb, KC) | 1 | 4 |
Hanna Kradolfer (2Mdz) | 2 | 4 |
Lorenzo Camani (1Mfz) | 1 | 5 |
Mirea Capizzi (1Ma) | 1 | 5 |
Dario Küng (2Mdz) | 2 | 5 |
Bernardo Bürger Brun (1Mfz, KC) | 1 | 6 |
Jonas Tibisch (2Mdz, KK) | 2 | 6 |
Mailo Rodriguez (1Mc) | 1 | 7 |
Dimitri Horn (2Mc) | 2 | 7 |
Johannes Stölzle (1Mfz) | 1 | 8 |
Darvin Subramaniam (1Mdz) | 1 | 8 |
Laurin Herzig (2Mez, KK) | 2 | 8 |
Andrin Schmid (1Mez) | 1 | 9 |
Lukas Tran (3Ma) | 3 | 9 |
Dylan Cetina (1Mfz) | 1 | 10 |
Joris Cremonese (1Ma) | 1 | 10 |
Leonardo Brun (2Mez) | 2 | 10 |