• 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!

GML Implement Spine functions for a State Machine

wilmer

Member
Greetings to everyone in the Community:

I need help with this, I have some codes that are to create a State Machine for the enemy, a fighting game, you see that there are some variables that assign different Sprites for each state, but I prefer to use Spine 2d Animation to create the animations and a single Sprite would be imported when importing it into the GMS since it has all the animations in a single file. Is it possible to change these codes so that the Spine functions are used, for example: skeleton_animation_set, instead of using Sprite_index, so that in the end it has the same purpose?, Which would be an AI for the enemy.

Script ( 1 ):
scr_enemy_sprite_config
Code:
if (global.enemy = obj_narutoE)
{
    stance_sprite = spr_naruto_stance ;   
    run_sprite = spr_naruto_run  ;
    jump_sprite = spr_naruto_jump ;
    fall_sprite = spr_naruto_fall ;
    
    combo1_sprite = spr_naruto_attack1 ;
    combo2_sprite = spr_naruto_attack2 ;
    combo3_sprite = spr_naruto_attack3 ;
    air_attack_sprite = spr_naruto_airattack ;
    
    hurt1_sprite = spr_naruto_hurt ;
    hurt2_sprite = spr_naruto_hurt2 ;
    
    block_sprite = spr_naruto_block ;
    throw_sprite = spr_naruto_throw ;
    
    special_sprite = spr_naruto_rasenrelease ;
}

Script ( 2 ):
scr_enemy_attack

Code:
if (attackindex != argument0)
{
    image_index = 0 ;
    image_speed = 0.4 ;
    attackindex = argument0 ;
    if (landed)
    {
        if (attackindex == 1)
        {
            sprite_index = combo1_sprite ;
            hittype = 1 ;
        }
        if (attackindex == 2)
        {
            sprite_index = combo2_sprite ;
            hittype = 1 ;
        }
        if (attackindex == 3)
        {
            sprite_index = combo3_sprite ;
            hittype = 2 ;
        }
    }
    scr_enemy_hit() ;
}
 
Top