Computer Science Canada Gravity and jumping |
Author: | hamid14 [ Sat Nov 28, 2009 3:58 pm ] | ||
Post subject: | Gravity and jumping | ||
What is it you are trying to achieve? Trying to make a picture "jump" up, then come down. Basically, im trying to make gravity. What is the problem you are having? Cant get the gravity to work right. Describe what you have tried to solve this problem I've tried making the y decrease after it reaches the max height for the jump, doesnt work. Post any relevant code (You may choose to attach the file instead of posting the code if it is too long) Heres the code
Please specify what version of Turing you are using 4.1 |
Author: | TheGuardian001 [ Sat Nov 28, 2009 4:29 pm ] | ||
Post subject: | Re: Gravity and jumping | ||
based on those two conditions, will the value of y ever be anything other than 100 when the character is drawn? |
Author: | highly [ Sat Nov 28, 2009 5:03 pm ] | ||||
Post subject: | Re: Gravity and jumping | ||||
gravity is a force, and is a constant. In this case, g(gravity) will always be a negative value acting on your character. But it wouldn't effect the y position of your character directly, it would effect that characters velocity. so y += yvel, and yvel is what is effected by keypresses
again, these are just some of the basics for applying physics in coding. It's very sloppy and incomplete because I'm not completely familiar with Turing's math operations. |
Author: | Kharybdis [ Sat Nov 28, 2009 11:54 pm ] |
Post subject: | RE:Gravity and jumping |
darn it, i have a complete simulation somewhere on my computer that has a very good explanation of how everything works and has an example of it... just need to find it. Sorry, writing this very late at night . MetaChief wrote it, you should ask him for it. I know it helped me a lot when doing elementary physics coding. |