Skip to content

Instantly share code, notes, and snippets.

@LearnCocos2D
Last active December 11, 2015 06:08
Show Gist options
  • Save LearnCocos2D/4557102 to your computer and use it in GitHub Desktop.
Save LearnCocos2D/4557102 to your computer and use it in GitHub Desktop.
Scrolling tilemap API from KoboldTouch. It covers practically every need: scrolling to or by position or tile coordinate. Moving with speed, duration or instantly. Check out KoboldTouch at: http://www.koboldtouch.com
/** Scrolls to the coordinate (in points) instantly. */
-(void) scrollToPosition:(CGPoint)position;
/** Scrolls to a tile coordinate instantly. */
-(void) scrollToTileCoordinate:(CGPoint)tileCoord;
/** Scrolls by a certain distance (in points) instantly. */
-(void) scrollByPointOffset:(CGPoint)pointOffset;
/** Scrolls by a certain distance (in tile coordinates) instantly. */
-(void) scrollByTileOffset:(CGPoint)tileOffset;
/** Scrolls to the coordinate (in points) with a given duration (in seconds). */
-(void) scrollToPosition:(CGPoint)position duration:(float)duration;
/** Scrolls to a tile coordinate with the given duration (in seconds). */
-(void) scrollToTileCoordinate:(CGPoint)tileCoord duration:(float)duration;
/** Scrolls to the coordinate (in points) with a given speed (in points per frame). */
-(void) scrollToPosition:(CGPoint)position speed:(float)speed;
/** Scrolls to a tile coordinate with the given speed (in points per frame). */
-(void) scrollToTileCoordinate:(CGPoint)tileCoord speed:(float)speed;
/** Scrolls by a certain distance (in points) with the given duration (in seconds). */
-(void) scrollByPointOffset:(CGPoint)pointOffset duration:(float)duration;
/** Scrolls by a certain distance (in tile coordinates) with the given duration (in seconds). */
-(void) scrollByTileOffset:(CGPoint)tileOffset duration:(float)duration;
/** Scrolls by a certain distance (in points) with a given speed (in points per frame). */
-(void) scrollByPointOffset:(CGPoint)pointOffset speed:(float)speed;
/** Scrolls by a certain distance (in tile coordinates) with a given speed (in points per frame). */
-(void) scrollByTileOffset:(CGPoint)tileOffset speed:(float)speed;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment