How can i make sprite in canvas to draggable only in x axis?

I want my sprite to be dragged only in x axis where it is set. When i set it to draggable, i can drag it any where in a screen. But i want to drag it only from left to right and right to left but not up and down.

Hey @shemanta.bhattarai18 ,

When you touch the sprite, save the y value in a variable and use this as a constant to keep the vertical position the same.

Let me know whether or not that helps.

1 Like

@domhnallohanlon This logic makes sense but I don’t see the blocks available to reference the y value while dragging it. I am another App Inventor convert…so, I’m sure my eyes are just looking for the wrong blocks. But I’m at a loss. I want to be able to drag a sprite horizontally only…as in a Pong like game.