πŸŽ‰ Celebrating 25 Years of GameDev.net! πŸŽ‰

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

jumping sprite

Started by
13 comments, last by Tom Sloper 1Β year 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

πŸ™‚πŸ™‚πŸ™‚πŸ™‚πŸ™‚<←The tone posse, ready for action.

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.

pbivens67 said: August 01, 2020
I am working on an old project that is like a 2d platformer, I have drawn two animated sprites and and

one can jump in parabolic fashion.

How come you can't answer your own β€œquestion” seeing that you've done it before???

https://gamedev.net/forums/topic/707654-game-advice/

That thread is a great example of you jumping ship after getting good advice.

πŸ™‚πŸ™‚πŸ™‚πŸ™‚πŸ™‚<←The tone posse, ready for action.

how do I draw an animated sprite?

This topic is closed to new replies.

Advertisement