Well I have decided to use a vector to store the values of a parabolic jumping algorithm. Then I iterate over the vector to get the values stored in the vector. I then output these values to get the sprite to jump in a parabolic fashion. My only problem is that when I run the code the sprite does not jump but only moves from one place to another in a straight path. I want the sprite to move in a parabolic arc from one point to another.
Here is my code.
void vec_jump()
{
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);
}
for (int i = 0; i < move_sprite.size(); i++)
{
cout << move_sprite[i] << endl;
y = move_sprite[i];
x += 2.0f;
}
}
void handleKeypress(unsigned char key, int x, int y)
{
switch (key)
{
case 27:
exit(0);
break;
case 32:
vec_jump();
break;