Skip to main content
Version: Release

Sprites

Sprite​

Sprite is a Drawable loaded from an image path or surface.

sprite = bf.Sprite("assets/hero.png")
sprite.set_center(100, 200)
scene.add("world", sprite)
  • from_path(path) / from_surface(surface)
  • set_size(size) — scales from the original surface

ScrollingSprite​

A tiled sprite that can scroll, useful for backgrounds.

bg = bf.ScrollingSprite("assets/tile.png", size=(800, 600))
bg.set_autoscroll(50, 0)
scene.add("world", bg)
  • set_scroll(x, y) / scroll(dx, dy)
  • set_autoscroll(vx, vy) — continuous scroll in world units per second