You can check out [url=http://www.phy.ntnu.edu.tw/ntnujava/index.php?topic=944.0]Fire work (projectile motion)[/url] and find out how I did it.