• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

GML Spine Animation - animated character to the left

wilmer

Member
Greetings to all:
I am a user of Spine and not if this is common, normally the characters in Spine are designed and animated looking to the right side, but I have a villain character that looks to the left side. The problem is that having it to that side, in Game Maker everything changes, the character throws a fireball by pressing the letter Z, if you see the video, the fireballs shoot out where they shouldn't. Of course with the characters that I design facing the right side I don't have any of those problems, except if I use (image_xscale = -1), which only turns the object but not the bones of the character.

This is the code that I use to launch the fireball, I start my games in GMS 1.4 and then I pass them to GMS 2, I don't know if this code is outdated:
GML:
l_shoot = ds_map_create();
skeleton_bone_state_get("left_forearm",l_shoot);//target the bone where the fireballs were created
shoot_angle = l_shoot[? "angle"];
xx = x + l_shoot[? "worldX"];//x and y of object
yy = y + l_shoot[? "worldY"];
if keyboard_check_released(ord ("Z"))
    {
    bullet = instance_create(xx,yy,obj_balloffire);
    bullet.direction = shoot_angle;
    bullet.gravity = .2;
    bullet.friction = .1;
    bullet.speed = 25 + random(3);
    }
ds_map_destroy(l_shoot);
 

TailBit

Member
Maybe something like:
GML:
xx = x + l_shoot[? "worldX"]*image_xscale;
But I think you might want to get the "xscale" of one of the first bones and flip that value instead of using image_xscale, that way the whole thing might be drawn the correct way and maybe give you more correct skeleton data .. I haven't really tried this myself, so this is just a shot in the dark ..
 
Top