• Hello [name]! Thanks for joining the GMC. Before making any posts in the Tech Support forum, can we suggest you read the forum rules? These are simple guidelines that we ask you to follow so that you can get the best help possible for your issue.

ERROR: json file is not a valid Spine animation...

boxzy

Member
When a spine file has the skin function, it gives the error
ERROR: json file is not a valid Spine animation...
If I delete all skins, I would be able to use the json; however, I need skins.
 

rIKmAN

Member
Skins work fine.

It sounds like you are using a version of Spine that isn’t supported by your version of GMS.

Unless you are using the latest GMS2 Beta, try using Spine v3.4.02.
 

boxzy

Member
I downgrade, but I could no longer load the project in Spine. I will buy GameMaker2 today, then test it. But I'm sure this will solve the problem.
 

rIKmAN

Member
I downgrade, but I could no longer load the project in Spine. I will buy GameMaker2 today, then test it. But I'm sure this will solve the problem.
Yeah that's normal - you can't load newer Spine projects into older version.

What you can do however is import the .json files as data and point to the correct images folder to easily recreate it in the older versions.
If you are buying GMS2 anyway and use the new beta version you will be able to load the files you already have into it, assuming they were made with Spine 3.7.
 

boxzy

Member
I'm making a gunner game, but I want to know, what is the best way to make the bullet spawn from the gun with a spine JSON.
 

rIKmAN

Member
I'm making a gunner game, but I want to know, what is the best way to make the bullet spawn from the gun with a spine JSON.
Create a "gun_tip" bone at the end of the gun where you want the bullet to spawn from, making sure the bone is a child of the bone you are using for the gun so that it will rotate along with the gun when you are aiming with the mouse.

Then use the skeleton_bone_state_get() function to get the x/y of the new 'gun_tip' bone which you can then use to spawn your bullet at the correct x/y position.
Also get the angle value from the bone you are using to rotate the arm/gun which you can then use to fire the bullet in the correct direction.

You may need to add some tweaks to the angle value depending on how you have your skeleton hierarchy setup, but that's the general idea.

For firing when you release the button, use mouse_check_button_released() (or the equivalent event) to handle your firing, and as the function name implies - it will only happen when you release the mouse button.
 

boxzy

Member
The Head of my character was too big so I've decreased the size, now I'm having problems loading it back in GameMakerStudio2.
Spine Error : sprite3 : Invalid JSON file C:\Users\Dario\Desktop\test\sprites\sprite3\9a620f1f-cddf-4070-bb70-f6153e6c04c4.json
 

boxzy

Member
Now I have a new error, my code that makes the character arm to point towards the mouse no longer works.

var map = ds_map_create();
skeleton_bone_state_get("b_arm", map);
var xx = ds_map_find_value(map, "worldX");
var yy = ds_map_find_value(map, "worldY");
var deltax = mouse_x - (x + xx);
var deltay = mouse_y - (y + yy);
var angle = -radtodeg(arctan2(deltay, deltax));
ds_map_replace(map, "angle", angle);
skeleton_bone_state_set("b_arm", map);
ds_map_destroy(map);
 

boxzy

Member
The error was fixed with this, I've removed the object X and Y being added to the bone X and Y. That's how the Manual has it.

var map = ds_map_create();
skeleton_bone_state_get("b_arm", map);
var xx = ds_map_find_value(map, "worldX");
var yy = ds_map_find_value(map, "worldY");
var angle = point_direction(xx, yy, mouse_x, mouse_y)
ds_map_replace(map, "angle", angle);
skeleton_bone_state_set("b_arm", map);
ds_map_clear(map);
 
Top