Navigation

    Fuze Arena Logo
    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Popular
    • Users
    • Groups
    • Help
    • Discord

    Tile Explorer

    General Discussion
    2
    3
    202
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • pianofire
      pianofire Fuze Team last edited by pianofire

      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
      
      1 Reply Last reply Reply Quote 6
      • lawyerlounge
        lawyerlounge last edited by

        I think for the "step forward" portion you meant if c.UP // not RIGHT

        pianofire 1 Reply Last reply Reply Quote 1
        • pianofire
          pianofire Fuze Team @lawyerlounge last edited by

          @lawyerlounge Thanks cut and paste error!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post