• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Having issues making bones move with code(Spine)

J

Jacob

Guest
So i'm trying to make one of the bones in my character follow the mouse but it just ain't working. I even used the gamemaker test code to see if it would work then, but it didn't.

Here's the gamemaker code.(Put it in the step event)

var map = ds_map_create();
skeleton_bone_state_get("head", 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("head", map);
ds_map_destroy(map);

"The above code creates a ds_map and then populates it with the data from the bone named "head". It then extracts the world position for the bone, and uses that data to set the "angle" of the bone to track the mouse position in the game."

I'm quite new to working with spine so i might be doing something terribly wrong. Thanks in advance:)
 
J

Jacob

Guest
How is it not working? What is happening?
Nothing is happening:S I think his head tilted a bit but that's all, but it's still frozen, nothing happens when i move the mouse what so ever.
 

trg601

Member
Oh wait, you said you put the code in the step event? to update the skeleton you need to make a "Animation Update" event, which is found in the "Other" tab.
 
Top