0

I have a sprite that want to drag but when I'm done dragging it want it to place it again to its original position. I have the following blocks:

enter image description here

The block is called without issue the first time (green flag). However, when I'm done dragging the sprite and it's called again in preparing shot, it appears the block doesn't get executed.

Any help is appreciated.

3 Answers3

1

You are using the wrong blocks. You are setting variables called "ball x" and "ball y": The set ball x and set ball y blocks.

You should be using the "set x" and "set y" blocks:
The set x to mouse x and set y to mouse y blocks.


Also, after you set the ball x and ball y, you are resetting the position:
Resetting after the position change.
I am not sure if that is intended.
VFDan
  • 831
  • 10
  • 26
0
forever
  go to x:[0] y:[0]
  wait until <<not<(x position) = [0]>>and<<not<(y position) = [0]>>and<not<mouse down?>>>>
end

http://scratchblocks.github.io/#?style=scratch3&script=forever%0A%20%20go%20to%20x%3A%5B0%5D%20y%3A%5B0%5D%0A%20%20wait%20until%20%3C%3Cnot%3C(x%20position)%20%3D%20%5B0%5D%3E%3Eand%3C%3Cnot%3C(y%20position)%20%3D%20%5B0%5D%3E%3Eand%3Cnot%3Cmouse%20down%3F%3E%3E%3E%3E%0Aend

Aetinx
  • 51
  • 1
  • 10
0

Because after mouseX and mouseY positions are called it instantly calls setInitialPosition so it doesn't move the ball to mouseX and mouseY.