GMSpriterAPI
#41
Posted 02 February 2013 - 04:05 PM
#42
Posted 02 February 2013 - 05:19 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!
#43
Posted 02 February 2013 - 10:06 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 swordNotice 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
#44
Posted 03 February 2013 - 05:35 AM
#45
Posted 11 February 2013 - 01:12 AM
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
#46
Posted 11 February 2013 - 04:06 AM
I dont know if the format is the same either. Best thing for you is to try it out
#47
Posted 19 February 2013 - 10:09 AM
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:17 PM.
#48
Posted 27 February 2013 - 08:41 AM
#49
Posted 27 February 2013 - 10:34 PM
#50
Posted 23 March 2013 - 03:43 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.
#51
Posted 21 April 2013 - 04:03 PM
i dont really understand how this works...
btw i still tried to see what it looks like and it doesn't work with the newest build from spriter beta, (also i don't have any idea of what is R3 sprite file...)
#52
Posted 21 April 2013 - 05:30 PM
Indecom4000: is working on it, but he is kind of bogged down in stuff to do right now with his current game, but according to his update to me, he will have to get it finished before he can finish his game, so it is a necessary part, so stay tuned, and hopefully if he sticks with his game, it will get done!
#53
Posted 21 April 2013 - 05:37 PM
You know there is another way to make use of Spriter w/o just reading in the scml file.. You can just export the animations to *.png files, then load those into a sprite into GM:Studio.. This is NOT as good as having access to the physics tweening etc.. But at least you can use it for animations for sprites!
Just trying to help some people who could have been using this tool all along, except for waiting for someone to make an api to read in scml files.. Just like Tradnux my other favorite animation creating tool based on joints..
Hope this helps you guys out while indecom finishes his work up..
Cheers!,
StOrM3
#54
Posted 23 April 2013 - 04:58 PM
ye but i'm using gm8
and he is working on gm studio
in gm8 it doesnt work anymore
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users











