Divinik
Member
I'm trying to use for loops to determine the area that the player's companions are able to go to, and for some reason sometimes it will work and shrink if the section is hitting a wall, and other times it won't.
Here's the code:
For my top and bottom section the code works like a charm. But when I tried to program it for the left sections, it would not work sometimes.
Any ideas?
Here's the code:
Code:
if collision_rectangle(bbox_left, character_inUse.bbox_top, bbox_left+(sprite_width/2), character_inUse.bbox_bottom, obj_wall, false, true)
{
for (i = bbox_left; i < bbox_left+(sprite_width/2); i++)
{
if !collision_line(i, character_inUse.bbox_top, i, character_inUse.bbox_bottom, obj_wall, false, true)
and collision_line(i-1, character_inUse.bbox_top, i-1, character_inUse.bbox_bottom, obj_wall, false, true)
{
bnd_limit_left = i;
}
}
} else {bnd_limit_left = bbox_left};
Any ideas?