by Crazy Star
Posted on December 29, 2006 at 7:21 PM
not 32 as you probably wantedIt's supposed to be 32*jumpLevel+2. The extra 2 is for making it look better - you can change it to be the exact height of the blocks but it isn't recommended:
As I mentioned before, an exact solution to this equation is going to be different from the value GM will come to because it's approximating this differential equation at 30fps which is a fairly pathetic resolution. The faster the jump velocity, the greater error you can expect. I suggest you just deal with it by allowing for that error in gameplay.
Edit: here's a better explanation:
The curved line is what the motion should be, ang the solution of the projectile's motion.
The dots are where GM sees the instance at 30fps, merely an approximation of the above.
The red lines are your error.
Lower the fps or increase the velocity, and the error climbs.
I see. But though I'm glad I understand why it didn't work it doesn't reall matter now as I found a solution to it. I now use
Which make the difference between my calculated distance and my expected distance close to or exactly zero with all the values I tried. I guess that is because the number of steps before gravity reaches 0 is always even or always uneven for some odd reason, and that is the opposite scenario of what would make the equation give 0.
CODEjumpPow = sqrt(2*gAdd*height)-gAdd/2;
I also noticed that when you jump through a platform, you jump 37.44 pixels high.I would like very much for you to prove how you discovered this. By the looks of it you're right though *goes back to code editor*.
I would like very much for you to prove how you discovered this. By the looks of it you're right though *goes back to code editor*.draw_text(x+40,y,string(minY-ystart))