Print out height of a sprite in a image sheet

So I used texture packer and they auto created a sprite data sheet.

I have properly linked the datasheet to the main file but I want it to print in the console the height of a sprite in the image sheet.

Morning. No computer available so cannot check it but doesnt the lua texturepacker contain this info? Should be easy to pull.

Other than that, you could create a displayobject, store the dimensions you need before removing it again. Unless you are using very large images and/or are pressed for exact timing, it should not be noticeable to the user

I second that.  I’m sure the output Lua file has that info in a table.

  1. I have verified this.

  2. Download this file: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/12/spriteDimensions.zip

  3. If you do this, you can print the dimensions of the sprites:

    local dice = require “dice” local frames = dice.sheet.frames for i = 1, #frames do print( "Frame " … tostring(i) … " has dimensions: " … tostring(frame[i].width) … " by " … tostring(frame[i].height) ) end

  4. This video shows how I exported and what the dice.lua file looks like:

https://www.youtube.com/watch?v=QSQE4a-UHkw&feature=youtu.be

Nevermind i got it.

Here is my code:

print(sheetInfo.sheet.frames[1].height)

May have over complicated my post a bit.

Not so sure a ‘nevermind’ reply is good enough after someone have provided both code, download and video to try and help you out.

I gave just a simple clue so i dont really expect anything but i thing RG deserves at least a thank you

couldn’t agree more… if you got helped then respect that help

Morning. No computer available so cannot check it but doesnt the lua texturepacker contain this info? Should be easy to pull.

Other than that, you could create a displayobject, store the dimensions you need before removing it again. Unless you are using very large images and/or are pressed for exact timing, it should not be noticeable to the user

I second that.  I’m sure the output Lua file has that info in a table.

  1. I have verified this.

  2. Download this file: https://github.com/roaminggamer/RG_FreeStuff/raw/master/AskEd/2017/12/spriteDimensions.zip

  3. If you do this, you can print the dimensions of the sprites:

    local dice = require “dice” local frames = dice.sheet.frames for i = 1, #frames do print( "Frame " … tostring(i) … " has dimensions: " … tostring(frame[i].width) … " by " … tostring(frame[i].height) ) end

  4. This video shows how I exported and what the dice.lua file looks like:

https://www.youtube.com/watch?v=QSQE4a-UHkw&feature=youtu.be

Nevermind i got it.

Here is my code:

print(sheetInfo.sheet.frames[1].height)

May have over complicated my post a bit.

Not so sure a ‘nevermind’ reply is good enough after someone have provided both code, download and video to try and help you out.

I gave just a simple clue so i dont really expect anything but i thing RG deserves at least a thank you

couldn’t agree more… if you got helped then respect that help