jumping sprite

Started by
9 comments, last by Tom Sloper 10 months, 4 weeks ago

I have asked this question before but I am revisiting this question, I want to get a sprite to jump in a parabolic fashion.

void jump(int val)
{
	y = (-0.01) * x * x;//-100 to 0 to -100
	x -= 5;// 100 to -100
	if (x <= -100)
	{
		x = -100;
	}
	glutPostRedisplay();
	glutTimerFunc(500, update, 0);
}
Advertisement

Please state the question in the form of a question, Phil.

-- Tom Sloper -- sloperama.com

ok well I have got the sprite to move up and down but what I want it to do is move up and down once not continuously like it does now.

void jump(int val)
{
	y = (-0.01) * x * x;//-100 to 0 to -100
	x += 5;// 100 to -100
	if (x >= 100)
	{
		x = -100;
	}
	glutPostRedisplay();
	cout << y << endl;
	glutTimerFunc(50, jump, 0);
}

Please phrase the question in the form of a QUESTION, as opposed to a STATEMENT, Phil. A question always ends with a question mark (?). We know what you want to do, but we don't know what question you are asking.

-- Tom Sloper -- sloperama.com

I watched the video and I get the hint and my little dog game is the project I am working on. yes, I am struggling with it but I still solve my problems it just takes me a little longer than most. I still enjoy it that's why I have not given up. I agree that the only way to get good at programming is to still program.

Another way to get good at it is to ask good questions (in the form of a question, ending with a question mark).

-- Tom Sloper -- sloperama.com

thanks I will try to do better.

how do I draw an animated sprite?

This topic is closed to new replies.

Advertisement