SOLVED Bouncing in clamped area

simple question
i wanna make an object change direction once it hits the inner edge of the area i clamped it in
how would i do that?


However you're setting the direction now... do that again when it's where you want it to be when it changes direction. But to a different direction.
i think i was being unclear
i got it clamped like this

x=clamp(x, obj_spawn_bg.x, obj_spawn_bg.x+750);
y=clamp(y, obj_spawn_bg.y, obj_spawn_bg.y+1080);

i want to know how to define the border
like how the object knows that it reached the border or the clamped area


if (object meets border?)
direction = random_range(300,315)