I don't know if anyone will tell you exactly how to do it, but start with this:
Figure out how to find the location of the player,
Figure out how to spawn an item at the players location,
Figure out how to add velocity to the spawned items toward your desired location (mouse pointer? directly forwards?)
I would look at the example projects like: https://sparklinlabs.itch.io/pirates-from-the-future and look at the scripts that control the cannons.