Beispiel #1
0
class first_scene(Scene):
    raspberry_sprite = None

    def load(self):
        self.raspberry_sprite = Sprite("art/raspberry35.png")

    def cleanup(self):
        pass

    def do_event(self, event):
        pass

    def update(self):
        self.raspberry_sprite.x = 100
        self.raspberry_sprite.y = 100
        return

        max_x = self.s.size[0] - self.raspberry_sprite.width()
        x = random.randint(0, max_x)
        max_y = self.s.size[0] - self.raspberry_sprite.height()
        y = random.randint(0, max_y)

        self.raspberry_sprite.x = x
        self.raspberry_sprite.y = y


    def draw(self):
        self.s.screen.fill((0,0,0))

        self.raspberry_sprite.blit(self.s)
Beispiel #2
0
    def spawn_bug(self):
        if len(self.bug_sprites) >= MAX_BUGS:
            return

        self.spawn_sound.play()

        new_bug = Sprite("art/bug1.png")
        new_bug.x = random.randint(0, self.s.size[0] - new_bug.width())
        new_bug.y = random.randint(0, self.s.size[1] - new_bug.height())

        self.bug_sprites.append(new_bug)