Non grid based animations

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
tomshreds
Party member
Posts: 101
Joined: Thu Oct 18, 2012 8:49 pm

Non grid based animations

Post by tomshreds »

Hi,

I'd like to know if it's possible to do animations with non grid based sprite sheets?

Like this one: Image

With this json file:

Code: Select all

{"frames": {

"Symbol 2 instance 10000":
{
	"frame": {"x":0,"y":0,"w":67,"h":92},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":4,"y":5,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10001":
{
	"frame": {"x":67,"y":0,"w":66,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":5,"y":4,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10002":
{
	"frame": {"x":133,"y":0,"w":67,"h":92},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":5,"y":3,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10003":
{
	"frame": {"x":0,"y":93,"w":67,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":6,"y":1,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10004":
{
	"frame": {"x":67,"y":93,"w":66,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":7,"y":0,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10005":
{
	"frame": {"x":133,"y":93,"w":71,"h":92},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":2,"y":0,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10006":
{
	"frame": {"x":0,"y":186,"w":71,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":2,"y":0,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10007":
{
	"frame": {"x":71,"y":186,"w":71,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":1,"y":2,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10008":
{
	"frame": {"x":142,"y":186,"w":70,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":1,"y":3,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10009":
{
	"frame": {"x":0,"y":279,"w":71,"h":93},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":0,"y":4,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
},
"Symbol 2 instance 10010":
{
	"frame": {"x":71,"y":279,"w":67,"h":92},
	"rotated": false,
	"trimmed": true,
	"spriteSourceSize": {"x":4,"y":5,"w":73,"h":97},
	"sourceSize": {"w":73,"h":97}
}},
"meta": {
	"app": "Adobe Flash CS6",
	"version": "12.0.2.529",
	"image": "p1_walk.png",
	"format": "RGBA8888",
	"size": {"w":256,"h":512},
	"scale": "1"
}
}
Is there any way I could use something like anim8 with those kind of coords? I don't mean using that json file but only the coords.

Any ideas?

Thanks!
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Non grid based animations

Post by Jasoco »

You'd be making it much more complicated than it has to be. Just use an image editor and move all the sprites onto a fixed grid. It'd be a lot easier than all the data that would be required to mark down all the quad locations and offsets they'd need to have to line up correctly.

There's a reason it's the most used method in game development.

Fake edit: I assume you're getting this JSON data and image from Flash or something? Does it not have an option for outputting to a grid instead?

I guess if you really needed to you'd have to write converter that would read all the JSON data for each sprite and output a table with the correct offsets for display.

But still, see if Flash can just output it on a grid.
tomshreds
Party member
Posts: 101
Joined: Thu Oct 18, 2012 8:49 pm

Re: Non grid based animations

Post by tomshreds »

Jasoco wrote:You'd be making it much more complicated than it has to be. Just use an image editor and move all the sprites onto a fixed grid. It'd be a lot easier than all the data that would be required to mark down all the quad locations and offsets they'd need to have to line up correctly.

There's a reason it's the most used method in game development.

Fake edit: I assume you're getting this JSON data and image from Flash or something? Does it not have an option for outputting to a grid instead?

I guess if you really needed to you'd have to write converter that would read all the JSON data for each sprite and output a table with the correct offsets for display.

But still, see if Flash can just output it on a grid.
Yes it's flash. You're right, I should be simply reformatting the sprite sheets. It's art from the open game art bundle here http://open.commonly.cc/ I don't have the flash source unfortunately.

Thanks for the great advice!
User avatar
Jasoco
Inner party member
Posts: 3726
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Non grid based animations

Post by Jasoco »

Ah. Good to know. Yeah, just use an image editor, there are plenty of them out there if you don't have one, and align all the sprites to a grid manually if you don't have the original Flash file or Flash itself.
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests