huenix
Member
Hello....
I have looked all over the forum, and others issues are not the same and/or use different codes...
When ever a AI/Player is knocked back, this code is called
it will work and prevent the AI/Player from passing through the "obj_character" OR "blocked_by" but never BOTH, now matter how i do it. and only when it is one or the other.
I have tried : | ...|| ...& ...&& ... (C) || (B) ... even and else if statement
What am i missing?
var blocked_by;
if (through_walls) && (over_pits = false) //ONLY walks through walls, NOT over pits
{
blocked_by = obj_pit;
}
if (through_walls = false) && (over_pits) //NOT walks through walls, Only over pits
{
blocked_by = obj_wall;
}
if (through_walls = false) && (over_pits = false) //NOT walks through walls, OR over pits
{
blocked_by = obj_solid;
}
if (through_walls) && (over_pits) //Walks through walls AND over pits
{
blocked_by = noone;
}
//Where AI is knocked to
if (knockedback)
{
if (place_meeting(x + knockedback_x, y + knockedback_y, obj_characters || blocked_by))
{
x += knockedback_x;
y += knockedback_y;
}
knockedback = false;
}
I have looked all over the forum, and others issues are not the same and/or use different codes...
When ever a AI/Player is knocked back, this code is called
it will work and prevent the AI/Player from passing through the "obj_character" OR "blocked_by" but never BOTH, now matter how i do it. and only when it is one or the other.
I have tried : | ...|| ...& ...&& ... (C) || (B) ... even and else if statement
What am i missing?
var blocked_by;
if (through_walls) && (over_pits = false) //ONLY walks through walls, NOT over pits
{
blocked_by = obj_pit;
}
if (through_walls = false) && (over_pits) //NOT walks through walls, Only over pits
{
blocked_by = obj_wall;
}
if (through_walls = false) && (over_pits = false) //NOT walks through walls, OR over pits
{
blocked_by = obj_solid;
}
if (through_walls) && (over_pits) //Walks through walls AND over pits
{
blocked_by = noone;
}
//Where AI is knocked to
if (knockedback)
{
if (place_meeting(x + knockedback_x, y + knockedback_y, obj_characters || blocked_by))
{
x += knockedback_x;
y += knockedback_y;
}
knockedback = false;
}