I’m still not clear on the rules of your game. The cancelable drag behavior uses the previous location not an initial or set location.
If it starts at A and is moved to an invalid location it returns to A. If it goes from A to B and then moved again to an invalid location it returns to B and so on.
I’ve never played with designing card games. You might need a formula or something more dynamic. I would study other card games.
Hi Keith,
In theory this is how Cancellable draggable works, but did you actually get your “cancel draggable object” code to return an object that starts at A back to A???
I’m not believing “cancel draggable object” returns an object that starts at A back to A, because I just wrote this code and it didn’t work, while “tween to position x,y” works and tweens an object that starts at A back to A.
That’s all I need is to tween an object that starts at A back to A.
Is it the action or the conditions? Is the variable correct and is the cursor not on a lower box?
It works for me. Although, it needs a trigger once otherwise the events keep getting triggered.
I don’t know what the lower box is, so I just used a huge box. It doesn’t go back to the start if the cursor is inside the box. But if the cursor is outside of the box.it returns to the previous location.
![ScreenRecorderProject26](https://forum.gdevelop.io/uploads/default/original/3X/c/1/c157745ec0f171733c7fb541f714401abbd3ff86.gif)
I don’t know what to tell you.
You’re amazing Keith, thank you!
I started a new prototype and your code worked and tweened the card back to original position with cancel drag!
To finally answer your question, the game’s premise is exactly the same as PvZ Heroes and very similar to Magic the Gathering, a card strategy game where you start with 20 life and try to get opponents life to 0 or less to win the game.
Thank you!
1 Like