Jump to content

[TOPIC: topicViewTemplate]
[GLOBAL: userSmallPhoto]
Photo

Unable to reuse sprite data generated by Texture Packer
Started by topfuncoolgames Mar 05 2013 11:14 AM

3 replies to this topic
[TOPIC CONTROLS]
This topic has been archived. This means that you cannot reply to this topic.
[/TOPIC CONTROLS]
[modOptionsDropdown]
[/modOptionsDropdown]
[reputationFilter]
[TOPIC: post.html]
#1

topfuncoolgames

[GLOBAL: userInfoPane.html]
topfuncoolgames
  • Enthusiast

  • 62 posts
  • Corona SDK

Hi all, new Texture Packer user here.

Texture Packer generated sprite data in Lua, very neat, but come with 1 problem.

I created my spritesheet using:

In first file, gunModule.lua,
local info = require ("variousItems")local sheet = graphics.newImageSheet("variousItems.png", info:getSheet())local gun1 = display.newSprite(sheet, info:getFrameIndex("gun"))

in the second file, boxModule.lua,
local info = require ("variousItems")local sheet = graphics.newImageSheet("variousItems.png", info:getSheet())local box = display.newSprite(sheet, info:getFrameIndex("box"))

Here comes the problem: info.sheet is becoming a .userdata after used by newImageSheet in gunModule, so in boxModule, newImageSheet will break.

The solution I got, would be to separate the box and gun sprites in 2 different spritesheet, which does sounds smart.

Any idea?
uid: 143031 topic_id: 36878 reply_id: 336878


[TOPIC: post.html]
#2

topfuncoolgames

[GLOBAL: userInfoPane.html]
topfuncoolgames
  • Enthusiast

  • 62 posts
  • Corona SDK

Sorry, just figured that is my own mistake to overwrite the table value.

Ignore this post.
uid: 143031 topic_id: 36878 reply_id: 145147


[TOPIC: post.html]
#3

topfuncoolgames

[GLOBAL: userInfoPane.html]
topfuncoolgames
  • Enthusiast

  • 62 posts
  • Corona SDK

Hi all, new Texture Packer user here.

Texture Packer generated sprite data in Lua, very neat, but come with 1 problem.

I created my spritesheet using:

In first file, gunModule.lua,
local info = require ("variousItems")local sheet = graphics.newImageSheet("variousItems.png", info:getSheet())local gun1 = display.newSprite(sheet, info:getFrameIndex("gun"))

in the second file, boxModule.lua,
local info = require ("variousItems")local sheet = graphics.newImageSheet("variousItems.png", info:getSheet())local box = display.newSprite(sheet, info:getFrameIndex("box"))

Here comes the problem: info.sheet is becoming a .userdata after used by newImageSheet in gunModule, so in boxModule, newImageSheet will break.

The solution I got, would be to separate the box and gun sprites in 2 different spritesheet, which does sounds smart.

Any idea?
uid: 143031 topic_id: 36878 reply_id: 66878


[TOPIC: post.html]
#4

topfuncoolgames

[GLOBAL: userInfoPane.html]
topfuncoolgames
  • Enthusiast

  • 62 posts
  • Corona SDK

Sorry, just figured that is my own mistake to overwrite the table value.

Ignore this post.
uid: 143031 topic_id: 36878 reply_id: 145147



[topic_controls]
[/topic_controls]