How to move image sprites on canvas

I am able to drag and move images on the canvas but i want them to move on the point where i touch them. Currently it doesnt matter where i touch them they move on their center but i want them to move on the point where i touch them like in any image editing apps

If i am understanding correctly, you want the images to move on the tip of your finger as you drag your finger accross the canvas? You could do “when sprite dragged” move sprite x = current x, y = current y

that moves the image on the top left point

would you want it on the center?
if yes then just do this:

move sprite x = current x + (sprite width/2)
y = current y + (sprite height/2)

no, on the point where i touch it

i know how to do it on the center

maybe this:
make a variable that stores x and y of the sprite (lets call these variables x1 and y1)
move sprite x = current x + ( start x - x1)
y = current y + (start y -y1)

then each time your done moving (ie, when touched up) save the new x and y in the x1 y1 variables

edit: this does not work

i will surely try this and get back to you but currently I’m studying

1 Like

Hey, Ive tested it and found the solution, discard everything ive said already, here is the blocks:

3 Likes

Thank you so much buddy… As i said will test it later.
Saved loads of time for me. Thank you!!!

1 Like

Hopefully it works for you, good luck with your apps and studies. If it works remember to mark it as solution.

Has it worked? if yes Mark it as solution

Yes!! Thank You So Much!!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.