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

Hard times with scripts...

F

ferdi2x

Guest
Hello there (and please forgive me for asking something in the wrong thread, if someone can fix that mistake),

I hope everyone's doing great these days.

I am currently following a Youtube tutorial (you can skip the first half part):

Yes, this is the part 2 but I have no issue with the part 1... It's on GMS 2.2.5.481 and I'm working on 2.3.1.542 (Trial version for the moment). I've been experiencing issues with the scripts as they have been updated in the 2.3 version. But I've been able to find a (the?) solution putting function Whateverthename(){ at the top of the code and a } at the bottom. Sorry, guys, I'm no expert in coding as you can guess.
But there still is a big issue. What's weird is that I'm pretty sure the very first time I ran it, it worked well. For sure I must have done some modifications later on but I really can't see where. Anyway. The character goes very well when I'm moving forward, backward and back to idle but when I try the kick or the punch actions then it loops for ever (kicking or punching)...

Let me show you the script for the Punch as an exemple (but maybe my mistake(s) is/are somewhere else):

GML:
// this is the code for the Update_punch script:

function Update_punch(){

// No movement

    hspeed = 0;
    vspeed = 0;

    // Change the state when the animation finishes

    var lastFrame = sprite_get_number(sprite_index) - 1;
    if (image_index == lastFrame)
        nextState = 0;
}


// and this is the code for the Start_punch script:

function Start_punch(){

    // Set the punch animation

    if (sprite_index != Spr_moulue_punch)
    {
    sprite_index = Spr_moulue_punch;
    image_index = 0;
    }
}
Please, save my soul, people! :)

Thank you very much for your attention.

F.
 
Last edited by a moderator:
Top