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

(SOLVED)Need some help with some code.

S

SBSomething

Guest
Hey everybody! Im working on some stuff with DnD and I wanted to implement an One-Button combo system like the one in this video.


I added the code into my system and matched everything according to my sprites and assets. However, when i run the code i get this error.

Code:
############################################################################################
FATAL ERROR in
action number 1
of  Step Event0
for object object0:

Variable object0._atk(100009, -2147483648) not set before reading it.
 at gml_Object_object0_Step_0 (line 7) - if (_atk && CanAttack && ComboCount < array_length_1d(Combo))
############################################################################################
--------------------------------------------------------------------------------------------
stack frame is
gml_Object_object0_Step_0 (line 7)
Maybe someone can help me out. here is the script im using

Code:
var_atk = keyboard_check_pressed(vk_right)

if (_atk && CanAttack && ComboCount < array_length_1d(Combo))
{
    switch (ComboCount)
    {
        case 0 :
            sprite_index = Combo[ComboCount];
            //spawn the collider
            break;
        case 1:
            sprite_index= Combo[ComboCount];
            break;
        default: show_error("Error found in player combo", true);
        
    }
    CanAttack = !CanAttack //flip the boolean value
    ComboCount ++;
    image_index = 0; //reset the animation
}


Thanks!
 
F

Fishman1175

Guest
Very first line, you need a space between "var" and "_atk"
 
Top