Flixel Power Tools FlxScrollZone

Back to the Flixel Power Tools

This class is a powerful way to create scrolling regions in any FlxSprite. A good example may be a background sprite which has a seamless (tiling)┬átexture on it. With this class you can make the texture scroll at any speed in any direction seamlessly but keep just one sprite on-screen. You can create as many scrolling zones as you like in one sprite, and add as many sprites as you like to the FlxScrollZone manager! It’s fast enough that the x/y scroll speeds can be fed to it in real-time. Lots of ┬áTest Suite examples showcase the various ways this can be used. The important thing to remember is that even with all that scrolling going on, the x/y values of the sprites being used are never touched. Perfect for game backdrops, sequences, skies, etc.

Screen Shot

Code Example

// This will scroll the whole image to the left by 2 pixels every frame
FlxScrollZone.add(pic, new Rectangle(0, 0, pic.width, pic.height), -2, 0);

// Creates a new scrolling zone within the same FlxSprite
FlxScrollZone.createZone(pic, new Rectangle(241, 16, 46, 46), -4, 0);

Recent Flixel Power Tool Posts

  1. Flixel Power Tools v1.9 Released
  2. Flixel Power Tools v1.8 Released - Let's get clicky
  3. Flixel Power Tools v1.7 - Kaboom!
  4. Flixel Power Tools v1.6 released including FlxControl
  5. Flixel Power Tools v1.5 - A monster of an update!
  6. FlxScreenGrab and FlxScrollZone added to Flixel Power Tools
  7. Flixel Power Tools v1.3 - Now Flixel 2.5 compatible!
  8. FlxHealthBar added to Flixel Power Tools

One Response

Leave a comment

Make yourself heard