well I have stubbed out my jump code. I have tried out my code and it counts up to 20 and keeps on counting 20 what I want is it to count back down to 0
#include <iostream>
using namespace std;
bool state = false;
float positionY = 0.0f;
float time = 0.0f;
int main()
{
cout << "positionY: ";
cin >> positionY;
cout << endl;
cout << "time: ";
cin >> time;
cout << endl;
for (int i = 0; i < time; i++)
{
if (state == false)
{
if (positionY < 20.0f)
{
positionY += 5.0f;
}
}
else if (state == true)
{
if (positionY >= 20.0f)
{
positionY -= 5.0f;
}
}
cout << "positionY: " << positionY << endl;
}
system("pause");
return 0;
}