Multidirectional Tile Scroller

author:
Geoffrey Mattie
description:
Scroll tiled images in any direction at any speed.
lastupdate:
2015-05-03
compatible:
v2.x
tag:
Scroll, Tile
homepage:
https://gist.github.com/gmattie/7347573
download:
https://gist.github.com/gmattie/7347573/download

Overview

MultidirectionalTileScroller is a Starling framework extension that easily facilitates multidirectional scrolling of a tiled texture.

After instantiating the object with a width, height and texture, scrolling can be achieved simply by supplying speed and angle arguments prior to or during a play() method call.

//Instantiate the object with a width, height and texture (and optional texture scaling)
m_Background = new MultidirectionalTileScroller(
                                               stage.stageWidth,
                                               stage.stageHeight,
                                               m_Texture,
                                               1.0,
                                               1.0
                                               );
//Add it to the stage
addChild(m_Background);
 
//Assign speed and angle values prior to calling play().
m_Background.speed = 2;
m_Background.angle = -42;
m_Background.play();
 
//Optionally pass new speed and angle arguments to the Start function.
m_Background.start(0.25, 180);
 
//Stop Scrolling by calling stop().
m_Background.stop();
 
//To maintain the previously set speed and angle properties, simply call play() again.
m_Background.play();

Public Properties

Public Methods

Notes

Changelog

Source Code

%gist(7347573)%

User Comments

Feel free to edit this part of the page!