How to code JUMPING into a game
If this is the stage you are at with your game, I would recommend using a game engine instead. Software development is about using the right tool for the job. With Xojo you’re going to have to re-implement all of these very basic things.
You see I have to use xojo for this project as it is a requirement. I can tell that Xojo isn’t the right software for game development as it is way easier to do this in unity
Here you go Dylan, do it in Unity and blow the socks off your Teacher
[quote=420008:@JulianS]Here you go Dylan, do it in Unity and blow the socks off your Teacher
The problem is I need to use Xojo…
Well, the first thing you could learn is how to describe your problem: “I want to do x because of y. I have tried a, b and c. Here is my current code.”
So what sort of game do you want to develop? Does it need to be fully fleshed out or just a starter? Which platform? Do you have something in progress?
If you are asking about the math involved it’s not that hard. You have to keep track of time for each frame of animation you are drawing and then you have to calculate the position of the jumper at that time so you know where to draw the jumper.
Depending on what is jumping and how the jumper itself should look when jumping, you will need to create or acquire a suitable series of animated frames and draw those at the appropriate times.
As for the math, jumping is basically an initial acceleration in some direction at t=0 followed by negative accelerations caused by gravity or drag, or collisions perhaps that occur in the game.
So the position is just the combined results of those accelerations followed over time. So essentially at each frame you take the time calculate the accelerations over that time from the last time, add them all up, and get a new position. That same calculation would be run again in the next frame.