Example #1
0
def setup(scene):
    scene.add(
        Planet(position=(3, 0),
               velocity=Vector(0, 1),
               image=ppb.Circle(40, 200, 150)))
    scene.add(
        Planet(position=(-3, 3),
               velocity=Vector(1, -1),
               image=ppb.Circle(200, 150, 40)))
    scene.add(
        Planet(position=(-3, -3),
               velocity=Vector(-1, 0),
               image=ppb.Circle(150, 40, 200)))
Example #2
0
def setup(scene):
    scene.background_color = (0, 0, 0)
    scene.add(
        ppb.RectangleSprite(width=0.5,
                            height=1,
                            image=ppb.Rectangle(200, 0, 0, (1, 2)),
                            position=(-2, 2)))
    scene.add(
        ppb.RectangleSprite(width=1,
                            height=0.5,
                            image=ppb.Rectangle(100, 200, 0, (2, 1)),
                            position=(0, 2)))
    scene.add(
        ppb.Sprite(size=1, image=ppb.Square(200, 200, 100), position=(2, 2)))
    scene.add(
        ppb.RectangleSprite(width=0.5,
                            height=1,
                            image=ppb.Triangle(0, 200, 0, (1, 2)),
                            position=(-2, 0)))
    scene.add(
        ppb.RectangleSprite(width=1,
                            height=0.5,
                            image=ppb.Triangle(0, 200, 100, (2, 1)),
                            position=(0, 0)))
    scene.add(ppb.Sprite(image=ppb.Triangle(50, 200, 150), position=(2, 0)))
    scene.add(
        ppb.RectangleSprite(width=0.5,
                            height=1,
                            image=ppb.Ellipse(0, 0, 200, (1, 2)),
                            position=(-2, -2)))
    scene.add(
        ppb.RectangleSprite(width=1,
                            height=0.5,
                            image=ppb.Ellipse(100, 0, 200, (2, 1)),
                            position=(0, -2)))
    scene.add(ppb.Sprite(image=ppb.Circle(150, 50, 200), position=(2, -2)))
Example #3
0
class Circle(Rotating):
    image = ppb.Circle(255, 71, 182)
Example #4
0
import ppb


tall_rectangle = ppb.Rectangle(200, 0, 0, (1, 2))
wide_rectangle = ppb.Rectangle(100, 200, 0, (2, 1))
square = ppb.Square(200, 200, 100)
tall_triangle = ppb.Triangle(0, 200, 0, (1, 2))
wide_triangle = ppb.Triangle(0, 200, 100, (2, 1))
square_triangle = ppb.Triangle(50, 200, 150)
tall_ellipse = ppb.Ellipse(0, 0, 200, (1, 2))
wide_ellipse = ppb.Ellipse(100, 0, 200, (2, 1))
circle = ppb.Circle(150, 50, 200)


def setup(scene):
    scene.background_color = (0, 0, 0)
    scene.add(ppb.RectangleSprite(width=0.5, height=1, image=tall_rectangle, position=(-2, 2)))
    scene.add(ppb.RectangleSprite(width=1, height=0.5, image=wide_rectangle, position=(0, 2)))
    scene.add(ppb.Sprite(size=1, image=square, position=(2, 2)))
    scene.add(ppb.RectangleSprite(width=0.5, height=1, image=tall_triangle, position=(-2, 0)))
    scene.add(ppb.RectangleSprite(width=1, height=0.5, image=wide_triangle, position=(0, 0)))
    scene.add(ppb.Sprite(image=square_triangle, position=(2, 0)))
    scene.add(ppb.RectangleSprite(width=0.5, height=1, image=tall_ellipse, position=(-2, -2)))
    scene.add(ppb.RectangleSprite(width=1, height=0.5, image=wide_ellipse, position=(0, -2)))
    scene.add(ppb.Sprite(image=circle, position=(2, -2)))


ppb.run(setup)