right....so I just fiddled around with some of the coding in my enemy's code and I am well aware I am still considered very new to coding as most of the code is just taken from YouTube videos lol.
anyways I have this bunch of code and I don't know where it went wrong so im jus gonna put it all here.
I suspect its around the area where the state of the enemy is still in stationary.
so right now what's happening is that I have several enemies in the room and all of em r spread out.
but now when I go close to them.they don't move at all.they are stuck in stationary state or something??idk
then only two enemies start moving and idk if this is related but they are very close to each other.
they were basically placed next to each other.
anyways I have this bunch of code and I don't know where it went wrong so im jus gonna put it all here.
GML:
hsp = dir * movespeed
vsp += grav;
if (hsp != 0) image_xscale = sign(hsp) * sc
if (place_meeting(x,y,player))
{
game_restart()
}
var enemyvar = instance_place(x,y,enemy)
with (enemyvar)
{
switch(states)
{
case states.stationary:
hsp = 0
if (abs(x - player.x)<64)
{
states = states.chase
}
states = states.chase
break;
case states.chase:
#region hsp vsp collision
if (place_meeting(x+hsp,y,wall))
{
while(!place_meeting(x+sign(hsp),y,wall))
{
x += sign(hsp)
}
hsp = 0;
dir *= -1;
}
//vertical
if (place_meeting(x,y+vsp,wall))
{
while(!place_meeting(x,y+sign(vsp),wall))
{
y += sign(vsp)
}
vsp = 0;
}
x += hsp;
y += vsp;
#endregion
break;
}
}
so right now what's happening is that I have several enemies in the room and all of em r spread out.
but now when I go close to them.they don't move at all.they are stuck in stationary state or something??idk
then only two enemies start moving and idk if this is related but they are very close to each other.
they were basically placed next to each other.