Exemple #1
0
    def aufbauen(self):
        BildSpeicher.lade_bild("ufo", "bilder/ufo.png", True)
        BildSpeicher.lade_bild("such_strahl1", "bilder/such_strahl_trans0.png", True)
        BildSpeicher.lade_bild("such_strahl2", "bilder/such_strahl_trans1.png", True)
        BildSpeicher.lade_bild("such_strahl3", "bilder/such_strahl_trans1.png", True)

        BildSpeicher.lade_bild("grass_1", "bilder/grass_1.png", True)
        BildSpeicher.lade_bild("grass_2", "bilder/grass_2.png", True)
        BildSpeicher.lade_bild("grass_3", "bilder/grass_3.png", True)
        BildSpeicher.lade_bild("grass_4", "bilder/grass_4.png", True)
        BildSpeicher.lade_bild("grass_5", "bilder/grass_5.png", True)

        BildSpeicher.lade_bild("fallschirm", "bilder/fallschirm.png", True)
        BildSpeicher.lade_bild("schaf_1", "bilder/schaf_1.png", True)
        BildSpeicher.lade_bild("schaf_2", "bilder/schaf_2.png", True)

        BildSpeicher.lade_bild("sonne", "bilder/sonne.png", True)

        zeit = 1000 / 6
        bilder_zeiten = []
        for i in range(1, 6):
            BildSpeicher.lade_bild("rauch_%d" % i, "../testimages/smoke_puff_000%d.png" % i, True)
            bilder_zeiten.append(("rauch_%d" % i, zeit))

        BildAnimationSpeicher.registriere_animation("rauch", bilder_zeiten)
        BildAnimationSpeicher.registriere_animation(
            "such_strahl", [("such_strahl1", 300), ("such_strahl2", 500), ("such_strahl3", 300)]
        )

        sonne = BildSpeicher.gib_bild("sonne")
        sonne.aendere_position(Spiel.breite - 150, 25)

        self.neues_schaf()
        self.neues_schaf()
        s = self.neues_schaf()
        s.fallschirm_rettung(300, 200)

        for i in range(schwierigkeit.anzahl_ufos):
            self.neues_ufo()

        anzahl = 60
        b = Spiel.breite / anzahl

        for i in range(1, anzahl):
            g1 = BildSpeicher.gib_bild("grass_" + str(random.randint(1, 5)))
            y_offset = random.randint(0, 10) - 5
            x_offset = random.randint(0, 10) - 5

            g1.aendere_position(i * b + x_offset, 360 + y_offset)