# Projectile Path Projection

**URL:** <https://forum.kirupa.com/t/projectile-path-projection/165336>\
**Category:** open source\
**Created:** [October 10, 2005, 1:56pm UTC](https://forum.kirupa.com/t/projectile-path-projection/165336 "2005-10-10T13:56:06Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![icio](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/icio/32/484_2.png) [@icio](https://forum.kirupa.com/u/icio)\
**Post date:** [October 10, 2005, 1:56pm UTC](https://forum.kirupa.com/t/projectile-path-projection/165336/1 "2005-10-10T13:56:06Z")

</div>

This is just a little something that I was thinking about. It’s a very small script, but may help someone who is wanting to achieve such an effect. Enjoy :thumb:

```auto
Stage.align = "TL"; Stage.scaleMode = "noScale"; _quality = "medium";

var startX:Number = 0; var startY:Number = 0;
var mouseIsDown:Boolean = false; var gravity:Number = 20;

_root.onMouseDown = function() { startX = _xmouse; startY = _ymouse; mouseIsDown = true; }
_root.onMouseUp = function() { mouseIsDown = false; }

_root.onEnterFrame = function() {
	_root.clear(); if (!mouseIsDown) { return; } _root.lineStyle(1, 0xCCCCCC, 100); _root.moveTo(startX, startY);
	
	var hVel:Number = _xmouse-startX; var vVel:Number = _ymouse-startY;
	var t:Number = 0; var x:Number = startX; var y:Number = startY;
	var draw:Boolean = true;
	
	while (y < Stage.height) {
		t+=0.1; //how detailed the line is. 0 = infinitely detailed (don't use this, obv)
		x = startX + hVel*t; y = startY + vVel*t + 0.5*gravity*t*t;
		if (draw=!draw) { _root.lineTo(x, y); } else { _root.moveTo(x, y); }
	}
}

```
