Home / Topic / Spritesheet.lua files not exporting correctly on Mac

Spritesheet.lua files not exporting correctly on Mac

Home Kwiksher Forums Kwik4 Spritesheet.lua files not exporting correctly on Mac

Viewing 2 posts - 1 through 2 (of 2 total)
  • #86007

    I mostly work on the PC. Then spritesheet.lua files are working correctly in the Windows and Mac simulators and on the device using a version of the project exported out of Photoshop in Windows. But I was exporting a version from Photoshop on the Mac using all the same files (except for necessary directory changes in the project.kwk file) just to test something and all the spritesheet.lua files returned errors. Below is copy of a spritesheet.lua file exported on the Mac and under that one is the same lua exported on the PC. They are clearly different. I am running the latest versions of Kwik4_2020_0330 and using master spritesheets and spritesheet luas generated with the latest version of Texturepacker.

    MAC (errors):

    local _M = {}

    local _K = require “Application”
    local json = require(“json”)

    local imageWidth = 78
    local imageHeight = 66
    local mX = 1657
    local mY = 1267
    local oriAlpha = 1

    local padkssa_options = {
    width = 128,
    height = 128,
    numFrames = ,
    sheetContentWidth = 512,
    sheetContentHeight = 512
    }
    _M.padkssa_sheet = graphics.newImageSheet( _K.spriteDir.. “apss1.png”, _K.systemDir, padkssa_options )

    — 2
    local padkssa_seq = {
    { name = “up”,
    start = 1,
    count = 12,
    time = 700,
    loopCount = 1,
    loopDirection = “forward”,
    },
    { name = “down”,
    start = 13,
    count = 12,
    time = 500,
    loopCount = 1,
    loopDirection = “forward”,
    },
    }

    function _M:localVars(UI)
    local sceneGroup = UI.scene.view
    local layer = UI.layer
    — , — elFraS
    — 12, — frameCount
    — 700, — elLength
    — , — elLoop
    — 128, — frameWidth
    — 128, — frameHeight
    — 512, — sheetWidth
    — 512, — sheetHeight
    — forward — elDirection
    end

    function _M:localPos(UI)
    local sceneGroup = UI.scene.view
    local layer = UI.layer
    if _M.padkssa_sheet == nil then return end
    layer.padkssa = display.newSprite(_M.padkssa_sheet, padkssa_seq ) — ff_seq is to be used in future
    if layer.padkssa == nil then return end
    layer.padkssa.x = mX
    layer.padkssa.y = mY
    layer.padkssa.alpha = oriAlpha
    layer.padkssa.oldAlpha = oriAlpha
    layer.padkssa:scale(imageWidth/layer.padkssa.width, imageHeight/layer.padkssa.height)
    layer.padkssa.oriX = layer.padkssa.x
    layer.padkssa.oriY = layer.padkssa.y
    layer.padkssa.oriXs = layer.padkssa.xScale
    layer.padkssa.oriYs = layer.padkssa.yScale
    layer.padkssa.name = “padkssa”
    layer.padkssa.type = “sprite”
    layer.padkssa:pause()
    sceneGroup.padkssa = layer.padkssa
    sceneGroup:insert( layer.padkssa)
    end

    function _M:didShow()
    end

    function _M:toDispose()
    end

    return _M

    PC (no errors):

    local _M = {}

    local _K = require “Application”
    local json = require(“json”)

    local imageWidth = 78
    local imageHeight = 66
    local mX = 1657
    local mY = 1267
    local oriAlpha = 1

    local padkssa_options = {}
    local newSheetInfo = function()

    — created with TexturePacker – https://www.codeandweb.com/texturepacker

    — $TexturePacker:SmartUpdate:c4ea52937cbbad46d173d7426a0033ba:9864fb5b9f7130cc4846e5995cf21b36:e7c8aa73b45a0c707ef4e453be97bba5$

    — local sheetInfo = require(“mysheet”)
    — local myImageSheet = graphics.newImageSheet( “mysheet.png”, sheetInfo:getSheet() )
    — local sprite = display.newSprite( myImageSheet , {frames={sheetInfo:getFrameIndex(“sprite”)}} )

    local SheetInfo = {}
    SheetInfo.sheet =
    {
    frames = {

    {
    — padk_0001
    x=0,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0002
    x=78,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0003
    x=156,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0004
    x=234,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0005
    x=312,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0006
    x=390,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0007
    x=468,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0008
    x=546,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0009
    x=624,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0010
    x=702,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0011
    x=780,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0012
    x=858,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0013
    x=858,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0014
    x=780,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0015
    x=702,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0016
    x=624,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0017
    x=546,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0018
    x=468,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0019
    x=390,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0020
    x=312,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0021
    x=234,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0022
    x=156,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0023
    x=78,
    y=0,
    width=78,
    height=66,
    },
    {
    — padk_0024
    x=0,
    y=0,
    width=78,
    height=66,
    },
    {
    — zaptr_0001
    x=936,
    y=0,
    width=588,
    height=916,
    },
    {
    — zaptr_0002
    x=936,
    y=0,
    width=588,
    height=916,
    },
    {
    — zaptr_0003
    x=0,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0004
    x=588,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0005
    x=1176,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0006
    x=1176,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0007
    x=1176,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0008
    x=0,
    y=916,
    width=588,
    height=916,
    },
    {
    — zaptr_0009
    x=936,
    y=0,
    width=588,
    height=916,
    },
    {
    — zaptr_0010
    x=936,
    y=0,
    width=588,
    height=916,
    },
    },
    sheetContentWidth = 2048,
    sheetContentHeight = 2048
    }
    SheetInfo.frameIndex =
    {
    [“padk_0001”] = 1,
    [“padk_0002”] = 2,
    [“padk_0003”] = 3,
    [“padk_0004”] = 4,
    [“padk_0005”] = 5,
    [“padk_0006”] = 6,
    [“padk_0007”] = 7,
    [“padk_0008”] = 8,
    [“padk_0009”] = 9,
    [“padk_0010”] = 10,
    [“padk_0011”] = 11,
    [“padk_0012”] = 12,
    [“padk_0013”] = 13,
    [“padk_0014”] = 14,
    [“padk_0015”] = 15,
    [“padk_0016”] = 16,
    [“padk_0017”] = 17,
    [“padk_0018”] = 18,
    [“padk_0019”] = 19,
    [“padk_0020”] = 20,
    [“padk_0021”] = 21,
    [“padk_0022”] = 22,
    [“padk_0023”] = 23,
    [“padk_0024”] = 24,
    [“zaptr_0001”] = 25,
    [“zaptr_0002”] = 26,
    [“zaptr_0003”] = 27,
    [“zaptr_0004”] = 28,
    [“zaptr_0005”] = 29,
    [“zaptr_0006”] = 30,
    [“zaptr_0007”] = 31,
    [“zaptr_0008”] = 32,
    [“zaptr_0009”] = 33,
    [“zaptr_0010”] = 34,
    }
    function SheetInfo:getSheet()
    return self.sheet;
    end
    function SheetInfo:getFrameIndex(name)
    return self.frameIndex[name];
    end
    return SheetInfo
    end
    padkssa_options = newSheetInfo().sheet
    _M.padkssa_sheet = graphics.newImageSheet( _K.spriteDir.. “apss1.png”, _K.systemDir, padkssa_options )

    — 2
    local padkssa_seq = {
    { name = “up”,
    start = 1,
    count = 12,
    time = 700,
    loopCount = 1,
    loopDirection = “forward”,
    },
    { name = “down”,
    start = 13,
    count = 12,
    time = 500,
    loopCount = 1,
    loopDirection = “forward”,
    },
    }

    function _M:localVars(UI)
    local sceneGroup = UI.scene.view
    local layer = UI.layer
    — , — elFraS
    — 12, — frameCount
    — 700, — elLength
    — , — elLoop
    — 128, — frameWidth
    — 128, — frameHeight
    — 512, — sheetWidth
    — 512, — sheetHeight
    — forward — elDirection
    end

    function _M:localPos(UI)
    local sceneGroup = UI.scene.view
    local layer = UI.layer
    if _M.padkssa_sheet == nil then return end
    layer.padkssa = display.newSprite(_M.padkssa_sheet, padkssa_seq ) — ff_seq is to be used in future
    if layer.padkssa == nil then return end
    layer.padkssa.x = mX
    layer.padkssa.y = mY
    layer.padkssa.alpha = oriAlpha
    layer.padkssa.oldAlpha = oriAlpha
    layer.padkssa:scale(imageWidth/layer.padkssa.width, imageHeight/layer.padkssa.height)
    layer.padkssa.oriX = layer.padkssa.x
    layer.padkssa.oriY = layer.padkssa.y
    layer.padkssa.oriXs = layer.padkssa.xScale
    layer.padkssa.oriYs = layer.padkssa.yScale
    layer.padkssa.name = “padkssa”
    layer.padkssa.type = “sprite”
    layer.padkssa:pause()
    sceneGroup.padkssa = layer.padkssa
    sceneGroup:insert( layer.padkssa)
    end

    function _M:didShow()
    end

    function _M:toDispose()
    end

    return _M

    Yamamoto
    Keymaster
    #86015

    Looking at the mac error. It seems reading the manual entry instead of the spritesheet lua generated from Texture packer.

    I extracted the spritesheet info from the win code above and pasted it into a new file on Mac. and it worked without an error.

    Can I have .kwk file of Mac? I would like to check the path of texture packer file in it.

          
        <replacement id="Rectangle_1">
            <name>Rectangle_1</name>
            <type>Sprite Sheet</type>
            <layer>Rectangle_1</layer>
            <file>~/Documents/Kwik/SpriteTest/eye.png</file>
            <frameWidth>128</frameWidth>
            <frameHeight>128</frameHeight>
            <externalFile>~/Documents/Kwik/SpriteTest/sprite_info.lua</externalFile>
            <exporter>TexturePacker</exporter>
    
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.