|
I cant see the physikal movement |
Max S
Member #5,508
February 2005
|
Hi first of all, sorry for my bad English. I try my best^^. i wont to write a very simple code, that could calculate a physic variable with a function. this is the simplest version of the code: int fall(int *h) { int g = 9; int t = 10; if (h > 0) { *h = (g / 2 * (t * t)); } } this is a very simple kind to calculate it!! but first i wont to try if its work trough given consts and after it I will change the code so, that it could calculate the time and the high by itself but its very simple, thers a picture wich should fall down, but if i run the code, the ball is on the ground. |
piccolo
Member #3,163
January 2003
|
int fall(int &h) { int g = 9; int t = 10; if (h > 0) { h *= (g / 2 * (t * t)); } } or int fall(int &h) { int g = 9; int t = 10; if (h > 0) { h = h*(g / 2 * (t * t)); } }
wow |
Max S
Member #5,508
February 2005
|
no this istn what i mean look this is the code
if i start it |
gnolam
Member #2,030
March 2002
|
My god man, learn to use indentation! The problems (well, besides the complete lack of indentation) are twofold: Oh, and I know capitalization exists in German, so please use it in English as well. -- |
Max S
Member #5,508
February 2005
|
Ok Ok sorry, but Im in stress here. Ok i try it. |
Onewing
Member #6,152
August 2005
|
Quote: t starts at 10, making h start at 450, which, depending on the graphics mode you've set, may be outside the screen. I think it'd be 500, since he's using ints. Or is it 400? I can never remember if integer division rounds up or down. @Max S: Timer logic will help maintain the proper speed on varying computers. You also need to understand the logic of a game loop. You only need to do a portion of your "fall" function each loop. You can add a float value to multiply the final calculation to make it only do 10% of the calculation per game loop. There are methods, I'm just rambling about some food-for-thoughts. ------------ |
Max S
Member #5,508
February 2005
|
At the beginn I sad that this is just a simple version of the code. But first i will try to make this counter work, this is the harder part for me. |
Kauhiz
Member #4,798
July 2004
|
Quote: I think it'd be 500, since he's using ints. Or is it 400? I can never remember if integer division rounds up or down. Doesn't round at all. It just chops the decimal part off. So 400. --- |
Onewing
Member #6,152
August 2005
|
Quote: Doesn't round at all. You guys and your technical accuracy. Bah, VB6.0 I believe did some form of rounding and I just carried the concept. ------------ |
|