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

Unsure of operator issue

J

Jmarlin3

Guest
I've been following the tutorial from Shaun Spaulding regarding Basic Artificial Intelligence

He constantly uses state_text in this form

Code:
state_text = ' ' ;
He uses a different word to identify which script it's using. The problem is everytime I use it, I get this error:
"unexpected unary operator ="
These are the instances I use it in:

scr_enemy_attack:
Code:
state_text = 'attack';

var dis = point_distance(x,y, o_player.x, o_player.y);
if (dis > attack_range) {
    // Chase
    state = scr_enemy_chase
} else {
    // Attack
    if (alarm[0] == -1) {
        o_player.hp -= 1;
        alarm[0] = 30;
            
        }

}
scr_enemy_idle:

Code:
state_text = 'idle';

var dis = point_distance(x,y,o_player.x,o_player.y);


if (dis <= sight_range)  {
    state  = scr_enemy_chase;
}
scr_enemy_attack:

Code:
state_text = 'attack';

var dis = point_distance(x,y, o_player.x, o_player.y);
if (dis > attack_range) {
    // Chase
    state = scr_enemy_chase
} else {
    // Attack
    if (alarm[0] == -1) {
        o_player.hp -= 1;
        alarm[0] = 30;
            
        }

}
Finally, in my enemy object, I have a drawing event with this:

Code:
draw_text(x,y,state_text);
That doesn't have any error warning, but everything else shows the same error.
Please help as much as possible.
 
Top