koniption23
Member
Hello all am a noob first off so any help is appreciated but I am having an issue where the enemy is getting stuck on the floor and im not sure why. my theory is that it may have to do with the origin but i have tried one in the middle. and at the base of the sprite with no luck.
GML:
/// moving and animation collision
//horizontal collision
hsp= dir* movespeed;
vsp += grav;
if(place_meeting(x+hsp,y,ground))
{
while(!place_meeting(x+sign(hsp),y,ground))
{
x+=sign(hsp);
}
hsp=0;
dir*=-1;
}
x+=hsp;
//vertical collision
if(place_meeting(x,y+vsp,ground))
{
while(!place_meeting(x,y+sign(vsp),ground))
{
y+=sign(vsp);
}
vsp=0;
}
y+=vsp;
if(place_meeting(x+hsp,y,obj_crate))
{
while(!place_meeting(x+sign(hsp),y,obj_crate))
{
x+=sign(hsp);
}
hsp=0;
dir*=-1;
}
x+=hsp;
//vertical collision
if(place_meeting(x,y+vsp,obj_crate))
{
while(!place_meeting(x,y+sign(vsp),obj_crate))
{
y+=sign(vsp);
}
vsp=0;
}
y+=vsp;
if (movespeed!=0)
{
sprite_index= run_test;
image_xscale=1;
image_speed=0.5;
}