Setting Boundry For Draggle Object [SOLVED]

I know for setting boundaries, I Gotta create a collision condition and set the action to keep the objects separate.

That’s all fine and dandy for when using the direction buttons. But when I set the Ball to being draggable Using Touch Screen, the image stops for a second, but if i keep dragging right, up, down, left, past the boundry, the ball just hops to the other side of the boundry.

the concept is to freely drag the ball around the screen in any direction within the boundry

how do i make sure that the object being dragged doesn’t hop the boundry when drag is continued?

I tried setting an action to stop the item from being dragged passed 0x, 0y, 800x, 600y. but that didnt work the way I was wanting to.

Thanks again for your help.

Try to check with the position of the object…
x position of the object is more than
x position of the object is less than
y position of the object is more than
y position of the object is less than

then

Change the position of the object of centre of the screen or wherever you want it to be…

If you use sprite obstacles, making them wider/thicker might help.
You can also do: if X position of ball > 600, set X position of ball = 600

1 Like

I figured it out right after I posted the question.

Here’s the screen shot of what I ended up doing.

Glad you figured it out.

High level recommendations for avoiding future issues/performance problems: You’ll want to add the “Trigger once” condition to pretty much all of these events.