/*
author: Mark and Avery 
date: 2/20/2004 .96702035023
purpose: Projectile motion test for Tank Game 
*/

#include <iostream>
#include <cmath>

#include "physics.h"

int main ()
{
	double theta, mapX, mapZ, t = 0.0, enemyX, enemyZ, gamma, r = 8.0;
	bool running = true;
	Physics::Projectile projectile1(100,3,t,32);

	std::cout << "PositionEnemy-X: ";
	std::cin >> enemyX;
	std::cout << "PositionEnemy-Z: ";
	std::cin >> enemyZ;

	std::cout << "Turret Direction: ";
	std::cin >> theta;
	projectile1.setDirection(theta);

	std::cout << "Turret Angle: ";
	std::cin >> gamma;
	projectile1.setAngle(gamma);

	while (running)
	{
       
		if (projectile1.getPositionHeight(t) < 0)
		{
			mapX = projectile1.getPositionX(t);
			mapZ = projectile1.getPositionZ(t);
			running = false;
		}

		t += .2;
	}

	if (abs((pow(mapX - enemyX,2) + pow(mapZ - enemyZ, 2))) <= pow(r,2))
		std::cout << "You hit the enemy!" << std::endl;

	std::cout << "x: " << mapX << " z: " << mapZ << std::endl;

	system("pause");

	return 0;
}
