Here you go:
Projectile Trajectory Demo.zip (58.2 KB)
Click and drag to change the trajectory, right-click to fire.
You can look up the formula for an ideal projectile’s trajectory:
-- Projectile position at a given time after launch
x = initial_pos.x + initial_velocity.x * time
y = initial_pos.y + initial_velocity.y * time - 1/2 * G * time * time
This doesn’t seem to match quite perfectly to Defold (it’s a little high at the apex), but it’s pretty darn close. You probably just have to tweak the gravity a tiny bit to match it up.
[Edit] Yeah, try multiplying G by 1.01, then it looks pretty good (at the end of line 4 of player.script in my demo)