Tile Explorer
-
A utility to step through tiles in a tiled image
sprite = createSprite() // To change sprite sheet position cursor inside brackets below and press Media key. // Then browse to a tiled image and press Y to paste it into the code image = loadImage("Kenney/boardgames") tiles = numTiles(image) scale = 1 setSpriteImage(sprite, image) setSpriteLocation(sprite, gWidth() / 2, gHeight() / 2) // centre on screen setSpriteAnimation(sprite, 0, tiles, 0) tile = 0 loop clear() c = controls(0) if c.left and tile > 0 then // fast reverse tile -= 1 endIf if c.down and tile > 0 then // step reverse tile -= 1 sleep(0.2) endIf if c.right and tile < tiles - 1 then // fast forward tile += 1 endIf if c.up and tile < tiles - 1 then // step forward tile += 1 sleep(0.2) endIf if c.a and scale < 5 then // increase scale scale += 1 sleep(0.2) endIf if c.y and scale > 1 then // decrease scale scale -= 1 sleep(0.2) endIf setSpriteScale(sprite, scale, scale) setSpriteAnimFrame(sprite, tile) size = tileSize(image, tile) width = int(size.x) height = int(size.y) printAt(0, 0, "tile ", tile, " of ", tiles, " width ", width, "height ", height, " scale ", scale) drawSprites() update() repeat
-
I think for the "step forward" portion you meant if c.UP // not RIGHT
-
@lawyerlounge Thanks cut and paste error!