How to stop moving object

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

Hi I need help to stop the object, I use swipe up gesture to make the object move up, and when the object hits a wall then object will destroy and go back to the default position.

What is the expected result

Explain what should happen when you run the game.

What is the actual result

the object will only move up if I swipe up

Related screenshots

here is the video

and here is the code

Use trigger once with swipe up gesture
Swipe up gesture detected
Trigger once -->Subtract block Y 10

like this ?

if like that its not working

I understand that when the object returns to the initial position it has to be stopped ???

The collision condition is incorrect. It’s the physics one, where I suspect you need the normal collision condition.

The physics expressions have this symbol image on the left of the condition, while standard events have this image

Yes, I want that condition in the object I created

I found that code in the gdev tutorial on YouTube that’s how they create a broken object animation, I tried the normal collision but it did not work so I used physics collision

Unless you are using physics behaviours on both objects, the physics collision is the wrong one to use. And even if you do have physics behaviour on it, you don’t change a physics objects position by increasing it’s position values.

But, back to your issue. The swipe direction condition is the direction of the last swipe. You need to add a “Swipe has just ended” condition when there is a swipe direction condition.

A friend said before that you should not use physics on objects. If both objects do not use physics.
I would do this. But that’s how I understand the problem. Because the solution, for me, is so simple that I am sure that I have misunderstood your problem.

I would change “change y position…” to “move to object new tiled sprite …” with permanent force.

I would change: When the " block_up" object collides with “new tiled sprite”…THEN…Destroy the object and create a new “block_up” object in the position you want.