GML
var c1,c2;
c1 = collision_line(x,y,xprevious,yprevious,obj_npc,false,true);
c2 = collision_line(x,y,xprevious,yprevious,obj_wall,false,true);
if c1 || c2 {
x = xprevious;
y = yprevious;
move_contact_all(direction,speed);
if distance_to_object(c1) < distance_to_object(c2) {
event_perform(ev_collision,obj_npc);
} else {
event_perform(ev_collision,obj_wall);
}
}
Teraz jest OK?
BTw. zamiast pisać:
GML
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
instance_create(other.x,other.y,obj_blood);
Możesz napisać:
GML
repeat(10) instance_create(other.x,other.y,obj_blood);