Jump to content


Photo

GMSpriterAPI


  • Please log in to reply
68 replies to this topic

#1 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 19 April 2012 - 05:01 AM

Summary
This adds support to load Spriter character animation files into your games.

Interface:

  • SpriterInit() Initializes the setup
  • SpriterLoadProject() Loads the SCML file. Supports multiple files
  • SpriterSetCharaterAnimation() Set the animation for the character
  • SpriterDrawCurrentFrame() Draws the animation frames
  • SpriterDebugMakeAnim() pops up a menu to create an animation from the characters available

NOTICE:
Included in the zip is the Spriter R1 and R3 character files, no harm intended, used for proof of concept

Limited support for R1 and R3

There are features in Spriter that could be supported... Collisions would need to be synchronized and I think there is hot point support to come in Spriter but the file did not have anything regarding the 2.

If you are interested, I can add support to fetch where an item is, like the sword in the animation so you can drop a collision enabled object at the location, so to detect sword hits. I could also provide support for compound characters where each sprite could possibly be linked to an instance.

Support
  • Spriter R1 files support
  • Spriter R3 files support
  • hot spot support (to us, x,y origins)
  • bounding box loading, no access

Issues:
  • The frame timing is slightly off (not noticeable though)
  • <charmap> section is ignored
  • <group> ignored

Please provide feedback... and I do have a donate link below in my sig :)


The Demo
It asks for the animation file when it starts
Right Click will show the characters available.
  • 6

#2 Arusiasotto

Arusiasotto

    GMC Member

  • GMC Member
  • 760 posts
  • Version:GM:Studio

Posted 19 April 2012 - 07:43 AM

Shiney. Good work Brosky.
  • 0

 

"It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter." - Nathaniel Borenstein

 

 

 


#3 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 19 April 2012 - 07:51 AM

I think a lot of us don't know what "Spriter character animation files" are, so it would be great if you could clarify that.
  • 0

Posted Image


#4 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 19 April 2012 - 07:54 AM

I think a lot of us don't know what "Spriter character animation files" are, so it would be great if you could clarify that.


http://gmc.yoyogames...1
  • 0

#5 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 19 April 2012 - 09:32 AM


I think a lot of us don't know what "Spriter character animation files" are, so it would be great if you could clarify that.


http://gmc.yoyogames...1

Wow, that looks great! Thanks!

EDIT: This is actually very useful. I've been looking for a software like this but haven't managed to find one. If only I knew about it before I started my current game :dry: :tongue:

Edited by D1g1talAli3n, 19 April 2012 - 09:38 AM.

  • 0

Posted Image


#6 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 19 April 2012 - 04:42 PM

EDIT: This is actually very useful. I've been looking for a software like this but haven't managed to find one. If only I knew about it before I started my current game :dry: :tongue:


We have a few tools like this on the GMC but most are a clumsy due to the nature of GM. GM's lack of GUI functions makes it hard to make things like this.

I was 3/4 done with mine when this came out. Now I'm not sure if I'll finish mine and risk being called a cloner. Seeing this in action, the 2 programs look like siblings separated a birth, one raised by Windows and the other raised by Ubuntu.
  • 0

#7 D1g1talAli3n

D1g1talAli3n

    BoyGenius

  • GMC Member
  • 965 posts
  • Version:GM8

Posted 19 April 2012 - 07:43 PM


EDIT: This is actually very useful. I've been looking for a software like this but haven't managed to find one. If only I knew about it before I started my current game :dry: :tongue:


We have a few tools like this on the GMC but most are a clumsy due to the nature of GM. GM's lack of GUI functions makes it hard to make things like this.

I was 3/4 done with mine when this came out. Now I'm not sure if I'll finish mine and risk being called a cloner. Seeing this in action, the 2 programs look like siblings separated a birth, one raised by Windows and the other raised by Ubuntu.

That's quite a sticky situation you're in. If I were you though, I'd continue on. I'd say given your skill, you could probably come up with something that'll be great, and not only that, you'll be able to have it easily portable to GM. I'm not quite so sure which one is Ubuntu and which one is Windows though :sweat:
May I ask, are you using GM to create your animation software?

Edited by D1g1talAli3n, 19 April 2012 - 07:45 PM.

  • 0

Posted Image


#8 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 19 April 2012 - 08:42 PM

That's quite a sticky situation you're in. If I were you though, I'd continue on. I'd say given your skill, you could probably come up with something that'll be great, and not only that, you'll be able to have it easily portable to GM. I'm not quite so sure which one is Ubuntu and which one is Windows though :sweat:
May I ask, are you using GM to create your animation software?


Mine looks like Windows. Yes, I'm using GM and WinApi 2 GEX. Originally, I started with VB but I had trouble with finding proper sprite support. As for being portable, the end result when loading the animation in the GM game is quasi identical; that is why it took only about 2 hours to make this, tweaked my setup to support the structure and the file format. It's just series of sprite references, position and styles.

I guess I'll keep going. One main thing is though, I tend to abandon a lot of things (I'm too strict on myself). so at least the community has this to help them out.
  • 0

#9 Cyahnidde

Cyahnidde

    GMC Member

  • New Member
  • 1 posts
  • Version:Unknown

Posted 19 April 2012 - 09:17 PM

I hate for my first post to be a (probably stupid) question instead of contributing something, but... I seem to be stuck.

First off, I'm new to the whole Game Maker scene (coming from using Flixel a lot) and am pretty interested in this stuff. I'm currently using Game Maker Studio so I can check out what Game Maker is all about.

So, Is it possible to use this on Game Maker Studio? If so, would you care to explain how to get this working? Thanks a lot!
  • 0

#10 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 19 April 2012 - 10:26 PM

I hate for my first post to be a (probably stupid) question instead of contributing something, but... I seem to be stuck.

First off, I'm new to the whole Game Maker scene (coming from using Flixel a lot) and am pretty interested in this stuff. I'm currently using Game Maker Studio so I can check out what Game Maker is all about.

So, Is it possible to use this on Game Maker Studio? If so, would you care to explain how to get this working? Thanks a lot!



Right click the scripts treeview folder, click Add existing scripts, locate the gml file provided.

Oops, that's broken and it made one huge pile of crap script. Just make a new project and import the gmk form the first screen. You can export the scripts in studio format afterwards

In the controller
//this function not suported by Studio ATM. hard code the path and filename
var fname; fname = get_open_filename("Spriter Files (*.scml)|*.scml","");
if(fname !="")
SpriterLoadProject(fname);
else
game_end();
  • 0

#11 Spector_Slayor

Spector_Slayor

    GMC Member

  • New Member
  • 81 posts

Posted 20 April 2012 - 02:01 AM

  • Title: GMSpriterAPI Beta1.
  • Description: Support for Spriter files (SCML)
  • GM Version: :GM81: :GM8:
  • Registered: Yes
  • File Type: .zip (gmk, gmres, gml, animation project file and resources)
  • File Size: 333kb
  • File Link: http://www.host-a.ne...MSpriterAPI.zip

Can someone create an alternate DL link, prefferably from this site. Host-a doesn't want to load the page for some reason.
  • 0
Did you know we can rotate objects in the room editor now┐ =)
Sneak Peak at my upcoming game [ScreenShot]
//Don't drink and script you may crash your computer.
Posted Image

#12 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 20 April 2012 - 02:42 AM


  • Title: GMSpriterAPI Beta1.
  • Description: Support for Spriter files (SCML)
  • GM Version: :GM81: :GM8:
  • Registered: Yes
  • File Type: .zip (gmk, gmres, gml, animation project file and resources)
  • File Size: 333kb
  • File Link: http://www.host-a.ne...MSpriterAPI.zip

Can someone create an alternate DL link, prefferably from this site. Host-a doesn't want to load the page for some reason.

Try again. I think it was down for a few moments.
  • 0

#13 Research

Research

    GMC Member

  • GMC Member
  • 94 posts

Posted 20 April 2012 - 06:34 PM

Very promising.
Especially the fact that portable while using only GML scripts.

In the SpriterAddSprite the "removeback" is better to false.

Edited by Research, 20 April 2012 - 09:10 PM.

  • 0

#14 kabecao

kabecao

    GMC Member

  • GMC Member
  • 333 posts
  • Version:GM:Studio

Posted 20 April 2012 - 09:56 PM

This is great!

A file of R2 Spriter (not Save Beta) return a error and only R2 version is available for download (I think).

if HTMLNextTag() = "<hotspotarray>" {
    while true if HTMLNextTag() = "</hotspotarray>" break;
}
After "if(thetag != "<spriterdata>") {show_message("Error reading <spriterdata>"); return 0;}" solves the problem until the new feauters aren't supported.

Edited by kabecao, 20 April 2012 - 10:10 PM.

  • 0

#15 SLarouche

SLarouche

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 20 April 2012 - 10:39 PM

Very nice work on the Spriter API!

I tried with GM8 this morning, and the idle animation was playing no problem.

But this evening I tried in GM8.1, and the game hangs on the init... Anyone had this problem too?

thank you,

Smon
  • 0

#16 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 20 April 2012 - 11:24 PM

Very nice work on the Spriter API!

I tried with GM8 this morning, and the idle animation was playing no problem.

But this evening I tried in GM8.1, and the game hangs on the init... Anyone had this problem too?

thank you,

Smon


I just ran it in GM8.1. It's incredibly slow to load. I think gm8.1 reworked the string system and it's slow like molasse. Frack I hate xml files. It's a stupid format.

I'll see if I can work something out. Same for the added tag. but not tonight. It's party time.
  • 1

#17 SLarouche

SLarouche

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 20 April 2012 - 11:44 PM

But not tonight. It's party time.


Amen.
  • 0

#18 Spector_Slayor

Spector_Slayor

    GMC Member

  • New Member
  • 81 posts

Posted 21 April 2012 - 01:02 AM



  • Title: GMSpriterAPI Beta1.
  • Description: Support for Spriter files (SCML)
  • GM Version: :GM81: :GM8:
  • Registered: Yes
  • File Type: .zip (gmk, gmres, gml, animation project file and resources)
  • File Size: 333kb
  • File Link: http://www.host-a.ne...MSpriterAPI.zip

Can someone create an alternate DL link, prefferably from this site. Host-a doesn't want to load the page for some reason.

Try again. I think it was down for a few moments.

No, still hangs on my PC. Can't DL it, can someone please upload here(no signup required/no ads/wait time) as a mirror?
edit: or any other hosting site, I seriously can't DL the file from Host-a. :mellow:

Edited by Spector_Slayor, 21 April 2012 - 06:58 PM.

  • 0
Did you know we can rotate objects in the room editor now┐ =)
Sneak Peak at my upcoming game [ScreenShot]
//Don't drink and script you may crash your computer.
Posted Image

#19 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 22 April 2012 - 01:47 AM

UPDATE Beta1.2 is up, same download.

Fixes GM8.1.
Faster loading
GM8.1 support

New R2 Spriter tags still not supported.

Will add R2 tags later.


@Spector_Slayor
Sorry about that. can you try with Firefox or EI or another browser? One should work. Having multiple files staggered around the web is not ideal for me, caused me a lot of trouble in the past when updating stuff, I forget to update all sources and someone gets the bad end of the stick.
  • 1

#20 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 22 April 2012 - 03:39 AM

UPDATE Beta1.3 is up, same download.
Spriter R1 files support
Spriter R3 files support
hot spot support
bbox loading
group ignored
  • 1

#21 Spector_Slayor

Spector_Slayor

    GMC Member

  • New Member
  • 81 posts

Posted 22 April 2012 - 06:09 AM

@Spector_Slayor
Sorry about that. can you try with Firefox or EI or another browser? One should work. Having multiple files staggered around the web is not ideal for me, caused me a lot of trouble in the past when updating stuff, I forget to update all sources and someone gets the bad end of the stick.


Ah this slipped my mind, anyways got it DL'd and tested. Thanks for working on it ^^ , but you're right it is quite slow (loading) and when the GM plugin is made I hope it's a lot faster.
  • 0
Did you know we can rotate objects in the room editor now┐ =)
Sneak Peak at my upcoming game [ScreenShot]
//Don't drink and script you may crash your computer.
Posted Image

#22 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 22 April 2012 - 06:20 AM

Ah this slipped my mind, anyways got it DL'd and tested. Thanks for working on it ^^ , but you're right it is quite slow (loading) and when the GM plugin is made I hope it's a lot faster.


The loading is almost instantaneous now, I rewrote the whole file loading system. Are you talking about the number of instance being low before the fps drops? That can be fixed. Optimization is in the works.

[edit]
I only tested on the supplied files. DO you have another that you find is slow to load?
  • 1

#23 superx140

superx140

    GMC Member

  • GMC Member
  • 119 posts

Posted 22 April 2012 - 10:24 AM

I see that GMSpriterAPI loads the sprites externally from files. Is it possible to load the files to the GM tree-view and use them instead? I've read that it is a lot faster as GM automaticly puts the sprites on texture pages.

I also see that GMSpriterAPI only uses GML and no DLL-file. Does that mean that you can load it with GMStudio (for ios games) too without using the extension system?
  • 0

#24 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 22 April 2012 - 04:19 PM

I see that GMSpriterAPI loads the sprites externally from files. Is it possible to load the files to the GM tree-view and use them instead? I've read that it is a lot faster as GM automaticly puts the sprites on texture pages.

I also see that GMSpriterAPI only uses GML and no DLL-file. Does that mean that you can load it with GMStudio (for ios games) too without using the extension system?

It's not faster or more efficient to have the images in your GM project. gm7,8,8.1. I cant vouch for GM Studio.

When they fix the import scripts to load the gml file properly in Studio, you will be able to add the Spriter feature to your game easily.

See post 10
  • 0

#25 SLarouche

SLarouche

    GMC Member

  • GMC Member
  • 95 posts
  • Version:GM:Studio

Posted 22 April 2012 - 10:13 PM

UPDATE Beta1.3 is up, same download.


Very impressive indeed. Works really well now.

One question, probably related to the fact that I am not familiar with the format, but why if I name my charater something else than: "first character" it only plays the first animation (idle) and never the walk. Any idea?

Thank you,

Simon
  • 0

#26 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 22 April 2012 - 10:50 PM


UPDATE Beta1.3 is up, same download.


Very impressive indeed. Works really well now.

One question, probably related to the fact that I am not familiar with the format, but why if I name my charater something else than: "first character" it only plays the first animation (idle) and never the walk. Any idea?

Thank you,

Simon


The system does not care what you name your animations or characters. Right click on the screen to add a new animation from the loaded file. You will see the character names and animation names available. Names you should use in SpriterSetCharaterAnimation

BTW, I would appreciate some more files to test with.
  • 0

#27 Spector_Slayor

Spector_Slayor

    GMC Member

  • New Member
  • 81 posts

Posted 23 April 2012 - 09:20 PM


Ah this slipped my mind, anyways got it DL'd and tested. Thanks for working on it ^^ , but you're right it is quite slow (loading) and when the GM plugin is made I hope it's a lot faster.


The loading is almost instantaneous now, I rewrote the whole file loading system. Are you talking about the number of instance being low before the fps drops? That can be fixed. Optimization is in the works.

[edit]
I only tested on the supplied files. DO you have another that you find is slow to load?


Much much much better. You're right it is virtually instantaneous now. Seems to be working wonderfully, tyvm. :thumbsup:

Edited by Spector_Slayor, 23 April 2012 - 09:21 PM.

  • 0
Did you know we can rotate objects in the room editor now┐ =)
Sneak Peak at my upcoming game [ScreenShot]
//Don't drink and script you may crash your computer.
Posted Image

#28 hexdump

hexdump

    GMC Member

  • GMC Member
  • 360 posts
  • Version:GM:Studio

Posted 18 July 2012 - 02:52 PM

Hi,

I know I'm kicking in a bit late, but have some questions about this software:

1) Has it been released? Can't see a download link on its website.
2) As I have been reading it seems there's no possibility to make all sprite parts into a texture or include them into a texture shared by other sprites (Yes, I'm using GMS and for us drawcalls are really important).
3) Do you think this is a good alternative to sprites for mobile systems?

Thanks in advance.
  • 0

#29 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 18 July 2012 - 07:08 PM

Hi,

I know I'm kicking in a bit late, but have some questions about this software:

1) Has it been released? Can't see a download link on its website.

The beta is still available on the page I link to

2) As I have been reading it seems there's no possibility to make all sprite parts into a texture or include them into a texture shared by other sprites (Yes, I'm using GMS and for us drawcalls are really important).

You can modify the code to use a texture an uvs to map to single sprite/texture. I dont really see the point as drawing primitives is slower than drawing sprites in GM plus I dont know if primitives are even implemented in Studio

3) Do you think this is a good alternative to sprites for mobile systems?

In depends. surely it shrinks the resource requirements especially for animations. A sprite based animation sequence yields a large animation image file when as a sequence of positions using the same chunks is much less demanding memory/size wise. However it is slower to have code that draws all the chunks in the right position each frame than using a plain jane animated sprite due to the nature of GM. Though this may not be a factor in the case of the java based executable Studio generates
  • 0

#30 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 07 October 2012 - 09:58 AM

Amazing, great to see someone works on this. Will you continue to improve it, or is it pretty much done? Also does Spriter offer to export your animation as a png sequence, or is this way the only one to get it into your game?

Thanks again.
  • 0

#31 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 07 October 2012 - 10:41 PM

Amazing, great to see someone works on this. Will you continue to improve it, or is it pretty much done? Also does Spriter offer to export your animation as a png sequence, or is this way the only one to get it into your game?

Thanks again.



The png sequence can be added with GM's sprite_add and sprite_merge functions
  • 0

#32 Primoz128

Primoz128

    GMC Member

  • GMC Member
  • 313 posts
  • Version:GM:Studio

Posted 08 October 2012 - 03:06 PM

Oh lol, i seen this once on kickstarter, then i didn't care anymore cause it was a long time till it was gona get out... hmmm... let's find out...
  • 0

Looking for a coding partner for my space RTS solar conquest project. More information: http://gmc.yoyogames...opic=563123&hl=


#33 mazimadu

mazimadu

    GMC Member

  • GMC Member
  • 241 posts

Posted 28 October 2012 - 05:40 PM

Is this version up to date with the latest version of spriter (I think it is at a4). If not, this should be updated.
  • 0

#34 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 13 November 2012 - 07:50 PM

Version 1.0 is out in december, so would probably make more sense to update it for the release.
  • 0

#35 The7DeadlyVenomz

The7DeadlyVenomz

    GMC Member

  • GMC Member
  • 237 posts
  • Version:GM:Studio

Posted 08 December 2012 - 09:47 AM

Has anybody tested Spriter on GMS, using a mobile device? I actually helped Kick it, and I'm getting ready to purchase GMS, so I'm just curious as to any positive or negative results.
  • 0
"Impossible is just a big word thrown around by small men who find it easier to live the world they have been given, rather than to explore the power they have to change it. Impossible is not a fact. It is an opinion. Impossible is not a declaration. It is a dare. Impossible is potential. Impossible is temporary. Impossible is nothing."
-- John Maxwell.

#36 derptomi

derptomi

    GMC Member

  • GMC Member
  • 25 posts
  • Version:GM:Studio

Posted 23 December 2012 - 01:09 AM

Someone seriously needs to try and update the plugin for GMS. Spriter 1.0 will come out in about a month!
  • 0

#37 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 23 December 2012 - 08:06 AM

Someone seriously needs to try and update the plugin for GMS. Spriter 1.0 will come out in about a month!


Remind me a few days before 1.0 is out. I may take the time. Does it work now?
  • 0

#38 Poethetortoise

Poethetortoise

    GMC Member

  • GMC Member
  • 22 posts
  • Version:Mac

Posted 20 January 2013 - 10:22 PM

Does this work on mac game maker?
  • 0

#39 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 20 January 2013 - 11:21 PM

Does this work on mac game maker?


If it allows you to import the gml script file in the zip
  • 0

#40 pikmin4000

pikmin4000

    GMC Member

  • GMC Member
  • 253 posts
  • Version:GM:Studio

Posted 02 February 2013 - 03:05 PM


Does this work on mac game maker?


If it allows you to import the gml script file in the zip


Well umm, anyone knows when Spriter is going to be released? It's already February and this would be perfect for the animations I'm working on now in Game Maker Studio. :confused:
  • 0

Still a beginner...
I progressed! I'm an intermediate game maker now.

Shaders, file saving, networking: I'm what they call- advanced.
shrinking_contract-banner.png


#41 RuinaImperi

RuinaImperi

    GMC Member

  • GMC Member
  • 438 posts
  • Version:GM:Studio

Posted 02 February 2013 - 04:19 PM

Check the update on their kickstarter page for more info: http://www.kickstart...5/spriter/posts
  • 0

#42 GrayKnight2k

GrayKnight2k

    GMC Member

  • GMC Member
  • 179 posts
  • Version:GM:Studio

Posted 02 February 2013 - 05:33 PM

If you are interested, I can add support to fetch where an item is, like the sword in the animation so you can drop a collision enabled object at the location, so to detect sword hits. I could also provide support for compound characters where each sprite could possibly be linked to an instance.


Hey,

I found this viewing your links after you helped me out in another post. Thank you for sharing Spriter and this API with us! (As an aside, I am also finding your other links very helpful, thank you).

I am interested in you adding the features quoted above (if you haven't already). Also, I am curious how you flip Spriter animations (for example in standard GML practice we use a negative xscale and yscale).

Do you have any additional documentation available explaining the use of your API with the .scml files? I've got hot-spot and standard anim. down, but I'm tending to want to use GML where it seems I need Spriter-specific commands (like xscale). Second, what is the command to load files without using a prompt to select it? I'm just looking to add files from my "game\graphics" directory on program load.

Thanks!
  • 0

#43 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 02 February 2013 - 10:20 PM


If you are interested, I can add support to fetch where an item is, like the sword in the animation so you can drop a collision enabled object at the location, so to detect sword hits. I could also provide support for compound characters where each sprite could possibly be linked to an instance.


Hey,

I found this viewing your links after you helped me out in another post. Thank you for sharing Spriter and this API with us! (As an aside, I am also finding your other links very helpful, thank you).

I am interested in you adding the features quoted above (if you haven't already). Also, I am curious how you flip Spriter animations (for example in standard GML practice we use a negative xscale and yscale).

Do you have any additional documentation available explaining the use of your API with the .scml files? I've got hot-spot and standard anim. down, but I'm tending to want to use GML where it seems I need Spriter-specific commands (like xscale). Second, what is the command to load files without using a prompt to select it? I'm just looking to add files from my "game\graphics" directory on program load.

Thanks!


Just remove the file dialog I used to ask for the file name...

for the collision, You can figure out what the index of the object you want by adding this in SpriterDrawCurrentFrame
right after
draw_sprite_ext(sprite,0,xx+ix,yy+iy,xscale,yscale,angle,color,alpha);
add
draw_text(ix,iy,i);

in the case of the supplied animation, the sword is at index 224

add a new sprite, sword_spr, load from file, open the supplied sword image

Create a new object, swordObj, set its sprite to sword_spr
add event END STEP wuith code
instance_destroy()

for debugging, add this on create
image_blend = c_red;

add your collision event in swordObj to the objects you need

Finally in the animated object the draw is

SpriterDrawCurrentFrame(x,y);
//sword object
    var idx; idx = 224;
    var xx; xx =x;
    var yy; yy =y;

    var angle; angle = ds_list_find_value(__FrameData,idx+3);
    var ix; ix = ds_list_find_value(__FrameData,idx+8);
    var iy; iy = ds_list_find_value(__FrameData,idx+9);
    var xscale; xscale = ds_list_find_value(__FrameData,idx+12);
    var yscale; yscale = ds_list_find_value(__FrameData,idx+13);
    
    with(instance_create(xx+ix,yy+iy,swordObj))
    {
        image_angle = angle;
        image_xscale = xscale;
        image_yscale = yscale;
        owner = other.id;
    }
You can also make sure you are in the right animation context, like in the right frames or in the right animation set... looking at __FrameAt and __FrameName... debug the data and figure out the right spot to "activate" the sword

Notice that the sword only lasts from the current draw to the next end step, allowing for the collision event to trigger on the next GM frame. Then it's gone, to be re-created if the context is still right.

notice I set swordObj.owner to the id of the animated object. in your collision event, you can inflict damage of give points to the owner

you can do the same for the head, the arms and so on.

when you know the collision matches, you can set swordObj to invisible

for the flipping, you can flip with this code in the draw

d3d_transform_add_scaling(image_xscale,image_yscale,1)
d3d_transform_add_translation(x,y,0)
SpriterDrawCurrentFrame(0,0);
d3d_transform_set_identity();
and of course if you added the collision stuff, you need to tweak it
d3d_transform_add_scaling(image_xscale,image_yscale,1)
d3d_transform_add_translation(x,y,0)
SpriterDrawCurrentFrame(0,0);
d3d_transform_set_identity();

    var idx; idx = 224;
    var xx; xx =x;
    var yy; yy =y;

    var angle; angle = ds_list_find_value(__FrameData,idx+3);
    var ix; ix = ds_list_find_value(__FrameData,idx+8);
    var iy; iy = ds_list_find_value(__FrameData,idx+9);
    var xscale; xscale = ds_list_find_value(__FrameData,idx+12);
    var yscale; yscale = ds_list_find_value(__FrameData,idx+13);
    
    with(instance_create(xx+ix*image_xscale,yy+iy*image_yscale,swordObj))
    {
        image_angle = angle * sign(other.image_xscale) * sign(other.image_yscale);
        image_xscale = xscale*other.image_xscale;
        image_yscale = yscale*other.image_yscale;
        owner = other.id;
    }

Similar tweaks will be needed for image_angle; using the d3d_transform_add rotation
the final code is
d3d_transform_add_rotation_z(image_angle)
d3d_transform_add_scaling(image_xscale,image_yscale,1)
d3d_transform_add_translation(x,y,0)
SpriterDrawCurrentFrame(0,0);
d3d_transform_set_identity();

    var idx; idx = 224;
    var xx; xx =x;
    var yy; yy =y;

    var angle; angle = ds_list_find_value(__FrameData,idx+3);
    var ix; ix = ds_list_find_value(__FrameData,idx+8) *image_xscale;
    var iy; iy = ds_list_find_value(__FrameData,idx+9) *image_yscale;
    var xscale; xscale = ds_list_find_value(__FrameData,idx+12);
    var yscale; yscale = ds_list_find_value(__FrameData,idx+13);
    var allangle; allangle = image_angle * sign(image_xscale) * sign(image_yscale);
    var apos; apos = point_direction(0,0,ix,iy);
    var dpos; dpos = point_distance(0,0,ix,iy);
    with(instance_create(xx+lengthdir_x(dpos,apos+allangle),yy+lengthdir_y(dpos,apos+allangle),swordObj))
    {
        image_angle = angle * sign(other.image_xscale) * sign(other.image_yscale) + allangle;
        image_xscale = xscale*other.image_xscale;
        image_yscale = yscale*other.image_yscale;
        owner = other.id;
    }
I noticed I forget to make the animation follow the GM image_alpha.
in SpriterDrawCurrentFrame
draw_sprite_ext(sprite,0,xx+ix,yy+iy,xscale,yscale,angle,color,alpha);
should be
draw_sprite_ext(sprite,0,xx+ix,yy+iy,xscale,yscale,angle,color,alpha*image_alpha);

[edit]
I have some issues with the math. it's not 100% accurate if the animation is scaled unproportianaly
  • 1

#44 GrayKnight2k

GrayKnight2k

    GMC Member

  • GMC Member
  • 179 posts
  • Version:GM:Studio

Posted 03 February 2013 - 05:49 AM

Thanks very much. Will take me a while to work through this, but really appreciate it.
  • 0

#45 storm3

storm3

    GMC Member

  • GMC Member
  • 76 posts
  • Version:GM:Studio

Posted 11 February 2013 - 01:26 AM

OK,

Here is the update I got from the authors of Spriter... The actual Pro Release that I already purchased will be available toward the end of Feb. sometime around the 20th or so.. Also, I am very interested in knowing what all to change in the script files to make it work inside GM:Studio.. I know the get_openfile stuff, and other obsolete functions will have to be removed, and have the path hardcoded.. But other than this, what all needs to be added to have the bones, rotation, scaling, collision stuff working using scml files..

Thanks for any and all info,

StOrM3
  • 0

[ Of All The Things I've Lost...]

[ I Miss My Mind The Most !!! ]

(Ozzy Osbourne & Hackers 1)


#46 icuurd12b42

icuurd12b42

    Self Formed Sentient

  • GMC Elder
  • 17266 posts
  • Version:GM:Studio

Posted 11 February 2013 - 04:20 AM

I dont know. I don't have studio. the get_openfile has nothing to do with the API I've written other than chossing a file in the demo of the API.

I dont know if the format is the same either. Best thing for you is to try it out
  • 0

#47 Indecom4000

Indecom4000

    GMC Member

  • GMC Member
  • 1633 posts
  • Version:GM:Studio

Posted 19 February 2013 - 10:23 AM

Hey guys, i've got GM:S and i've started work on getting this api to work, as of right now loading the png files fails, however the actual animations themselves are loading up just fine as evident by my placeholder sprites. Any clue why GM:S isnt loading the png files?

EDIT: fixed the issue, GMSpriterAPI seems to be working perfectly for GM:S after just a couple of minor tweaks. I merely had to move all the sprite data to be loaded to be within that special "sandbox" that GM:S works in.

EDIT 2: It seems like the latest update of Spriter isnt supported, so I'll be implementing that as well. If someone beats me to it, message me!

EDIT 3: After a couple days of work, reading the pdf's on the site and viewing some up to date scml files i've managed to devipher the complete new file format, and have GM:S reading the majorit of the data just fine. There are a few key items missing, but i suppose they'll be into the loading script in the coming days, as i'm also working on a rather large project of my own. The next steps after loading all this data is getting keyframe tweening working on simple boneless animations before moving on to the more complex bone animations.

Edited by Indecom4000, 22 February 2013 - 12:31 PM.

  • 2

LD-Logo-sml.png


#48 mazimadu

mazimadu

    GMC Member

  • GMC Member
  • 241 posts

Posted 27 February 2013 - 08:55 AM

Question: Is it possible to just simply use the sprite image indexes? I would like to use my player sprites as body parts instead of loading them externally.
  • 0

#49 Indecom4000

Indecom4000

    GMC Member

  • GMC Member
  • 1633 posts
  • Version:GM:Studio

Posted 27 February 2013 - 10:48 PM

You'll have to crack into the api source, but it shouldnt be too hard to add. You'll just have to figure out a way to change the referenced sprites to ones that already exist. This is actually something I intended to add to the update I'm working on.
  • 0

LD-Logo-sml.png


#50 RookieDev

RookieDev

    GMC Member

  • GMC Member
  • 115 posts
  • Version:GM:Studio

Posted 23 March 2013 - 03:57 AM

This Program is amazing and i cant use it!!! WHY!! I bought the Pro edition for One hundred dollars and this isnt going to work? How can you not have this compatible with the main version?? i really would love to use this.


  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users