A slingshot is not too terribly difficult. I’ll try to explain.
You’ll need 2 objects, the sling and the shot. (Not official names for a slingshot but whatever). The shot is what the user drags and the sling is what stays in one spot.
When the user presses the shot, set a variable to 1. I’d call it “Touch” or something of the sort.
Then do a block for
when Touch == 1, do a
set Touch to 0. Then do a
wait 10, and check if it is still equal to 0. Do that 3 more times, so that the
check if blocks are in one another. Then in the last
check if Touch == 0 do
set Touch to 2.
Now, when Touch == 2, that signifies the end of the touch. Cool.
when Touch == 2 block. Inside of that, set a variable on the shot named something like ‘X Verlocity’ to the Sling X position - the shot x Position, then divide that by 5 or something so it’s not super powerful. Do the same for the Y. Then, set it’s State or some variable to 1.
Now, make a
when State == 1. Inside of that do a Set Position block, and set the X to
x velocity + x position and the y to
y velocity + y position. Wham. Now the shot moves when you drag it back.
For gravity, just make another
when State == 1 block, and put a
increase y velocity by -1 block in that.
If you want to reset the slingshot, just set it’s State to 0, and then put the position to wherever the sling is located.
And if all this doesn’t make too much sense (I know, it’s a lot) check out this project I made a while ago: