Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17625

using a vectror to shoot a bullet

$
0
0

I am able to draw a bullet at the front of the cannon of my tank sprite. I want the bullet to shoot at the enemy tank in a parabolic arc. I have drawn two tanks that move horizontally along a grassy ground sprite. the tanks are also sprites. 

int i = 0;

int animate;

void vec_shoot()
{
	vector<float> move_sprite;

	for (float x = -14.0f; x <= 14.0f; x += 2.0f)
	{
		y = (-0.1f*(x*x)) + 20.0f;
		move_sprite.push_back(y);
	}

	y = move_sprite[i];
	x += 2.0f;
	if (x >= 30.0f)
	{
		x = 0.0f;
	}
	i++;
	if (i >= 15 …

Viewing all articles
Browse latest Browse all 17625

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>