Need some spritesheet explication

Hello corona community :slight_smile:

i am using spritesheets and i am working with a project done by a person and i understand and change and make new code and all is working but the spritesheet image was made by other person, the person who makes the original code, and know i need to create my spritsheet image but i dont know how it works, i know how to create image and then put on texturepacker to create a spritesheet, but i dont know how to program this part:

local greenSheet = sprite.newSpriteSheet( “greenman.png”, 128, 128 )–> 128,128 how i know this?and if i change this values the game dont run, how i can see this dimension?
local greenSet = sprite.newSpriteSet(greenSheet, 1, 15)–> 1,15 it means that i have 15 images and is true and i think that i understand this part, because i change the images by this values, 1 until 15 using frames, i really need about dimensions and this important configurations with spritesheets images, if anyone can talk a little about it or give me some information on internet, i I researched but dont find nothing about sprite dimensions, to resolve my doubts

Thanks [import]uid: 26056 topic_id: 16867 reply_id: 316867[/import]

search for spritegrabber in the code exchange it simplifies spritesheets [import]uid: 7911 topic_id: 16867 reply_id: 63191[/import]

yes i know sprite grabber but i only have this simple code,

local greenSheet = sprite.newSpriteSheet( “greenman.png”, 128, 128 )

local greenSet = sprite.newSpriteSet(greenSheet, 1, 15)

local spawner = sprite.newSprite( greenSet )

and on my function:

spawner.currentFrame = spawner.currentFrame - 1
or
spawner.currentFrame = spawner.currentFrame + 1

it is really simple, only need to know how i can create a spritesheet image with the right dimensions and how i know the dimension, to make some like 128,128 my doubts is the dimensions of sprites i really only need to implement image on the game only need to know it:

local greenSheet = sprite.newSpriteSheet( “greenman.png”, 128, 128 )–> the right dimensions of my spritesheet

local greenSet = sprite.newSpriteSet(greenSheet, 1, 15)–> and the number of frames that is easy, it is equal to the number of images on sprite

but i am learning the sprite grabber and dont know what is this values { fly={1,8,500,0}, stand={9,1,1,1} } ), the values on sprites is my great doubt :confused:

  1. Get a named “sprite” into screen and setup its animation clips, in 1 line:
    local superman = heroes:grabSprite(“superman”, true, { fly={1,8,500,0}, stand={9,1,1,1} } ) [import]uid: 26056 topic_id: 16867 reply_id: 63196[/import]

in spritegrabber
heroes is the name of the spritesheet loaded
superman is the beginning of the file name for all superman images
fly & stand are the name of the clips you are making
1 is the start frame for fly
8 is how many images make up the clip
500 is how fast the clip plays
0 means to repeat animation
9 is the start frame of stand ( 8 frames for fly next frame starts stand)
1 means 1 frame
1 is time to play
1 means play 1 time only

the only way to know how big the sprites need to be is ask original creator,read though their code, or guess till you get it right
or if you have the original spritesheet load it into ps or gimp create a new layer on top make your images same size, spacing as the original
hope this helps [import]uid: 7911 topic_id: 16867 reply_id: 63203[/import]

yeh i will use spritegrabber, i am working now on it, i will create a spritesheet image and i will try to make a animation with that, and change the other spritesheet images with frames, and if i have some doubts or errors and cant resolve i will post thank you very much for this help :slight_smile: [import]uid: 26056 topic_id: 16867 reply_id: 63204[/import]

forgot to say that in the above example this is the filenames for the sprite

image 1 - superman_fly01
image 2 - superman_fly02
3 - superman_fly03
4 - superman_fly04
5 - superman_fly05
6 - superman_fly06
7 - superman_fly07
8 - superman_fly08
image 9 - superman_stand01

this way when you tell spritegrabber “superman” it looks for all images that start with the name superman that way if the sheet also had luther images it would skip over them and just get superman
[import]uid: 7911 topic_id: 16867 reply_id: 63206[/import]

i am learning and trying to create animations with spritegrabber, i am trying to show the images that is on my sprite, but nothing appear :confused: i have 2 images on the sprite, and have this code:

display.setStatusBar( display.HiddenStatusBar )  
  
local grabber = require ("SpriteGrabber")  
  
local heroes = grabSheet("mysprite")  
  
local superman = heroes:grabSprite("superman", true, { fly={1,1,500,0}} )  
  
superman:playClip("fly")  
  

i am really new on sprites and never worked with sprites before, anyone can help on this simple process? [import]uid: 26056 topic_id: 16867 reply_id: 63372[/import]

Exist any link to download code with images about spritegrabber? i really need to see how it works because i need to understand how i can run a image by the sprite, need to import correctly the sprite, it is very important to learn [import]uid: 26056 topic_id: 16867 reply_id: 63481[/import]

Just a quick correction Andre,

above you wrote:

local greenSheet = sprite.newSpriteSheet( "greenman.png", 128, 128 )--\> the right dimensions of my sprite sheet 

This is not correct. 128,128 refers to the size of your individual sprites within the sprite sheet, and assumes they are all the same size.

reference: http://developer.anscamobile.com/reference/sprite-sheets [import]uid: 64596 topic_id: 16867 reply_id: 63504[/import]

i create a spritesheet with 2 images and both have the same dimensions, 100x112 and cant run it, i think the problem is the creation of the spritesheet, because the code run with the default spritesheet done by peach pellen, but when i try to use my spritesheet it dont run, i am using texture parcker but dont have license, but i can create spritesheets :S [import]uid: 26056 topic_id: 16867 reply_id: 63587[/import]

up [import]uid: 26056 topic_id: 16867 reply_id: 63668[/import]