Skip to content

Kromey/bevy_scroller

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bevy_scroller

A small Bevy plugin to scroll things.

crates.io crates.io docs.rs

parallax

About

Scroll predefined image sets, random images from sets, single image or even write own generators to generate scroller items (might be not images at all). You can also create parallaxes with it.

Features

  1. Change scroll direction
  2. Support different scroll item sizes
  3. Render to texture
  4. Pre-build generators:
    1. Single - repeat single image
    2. Sequence - repeat sequence of iamge
    3. Random Sequence - scroller will consist of random iamge from sequence
    4. Custom generators - set up your own system to generate scroller items. With this, you can scroll not only images but anything

Todo

  • make it work with spritesheets
  • scroller run conditions (when player moved, for instance)
  • change scroll direction on the go
  • some cases might be optimised with using shaders.

Usage

spawn a scroller-entity with:

  1. ScrollerSize component
  2. Scroller component
  3. If you want any of pre-build generators, attach ScrollerGenerator component
  commands.spawn((
    ScrollerGenerator::SpriteSingle("scroller_image.png".into()),
    ScrollerSize {
      size: Vec2::new(500., 300.),
    },
    ScrollerBundle {
      scroller: Scroller {
        speed: 1.,
        direction: ScrollerDirection::Forward,
        ..default()
      },
      ..default()
    },
  ));

Examples

example preview description
single shows a basic usage
sequence shows a usage of sequence generator
random_sequence shows random sequence generator
multiple example of muptiple scrollers
mirrors parallax example of how you can render scroller to texture and then use that texture to show this same scroller in other parts of applications
parallax parallax showing how you can set up a parallax with this plugin
poisson parallax use of poisson generator to fill space with sprites and scroll them all. Set up radius to ensure that no entity generated closer than that radius.

Credits

About

Scroller plugin for Bevy

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Rust 100.0%