if i put no code in the thje step his normal assigned sprite shows but if i put code in there he doesnt show up.
create code
step event
create code
GML:
//triggers
alarmed = false;
scared = false;
alarmrange = 100;
panicrange = 50;
z = 0;
//states
IDLE = 10;
ALARMED = 11;
SCARED = 12;
state = IDLE;
GML:
switch (state) {
case IDLE:
image_speed = global.animFPS/2;
sprite_index = asset_get_index(sNPCman1idle);
break;
case ALARMED:
image_speed = global.animFPS/2;
sprite_index = asset_get_index(sNPCman1alarmed);
break;
case SCARED:
image_speed = global.animFPS/2;
sprite_index = asset_get_index(sNPCman1scared);
break;
}
if instance_exists(oParPlayer) // if there's any Player instance alive
{nearestOpponent = instance_nearest(x, y + z, oParPlayer); } // the enemy looks for the nearest one
//add if punch eventually
if distance_to_object(nearestOpponent) < alarmrange
{state = ALARMED}