# Gravity and Jumping in Clickteam Fusion 2.5

So I'm currently building a bare-bones functioning game that involves simple platforming. Quite literally a box moving left and right and jumping. I'm using Clickteam Fusion 2.5, and I know there's an option to assign platforming movement to an active object, but I honestly do not enjoy implementing that feature one bit.

So instead I'm opting for simply adding or subtracting from the X and Y coordinates of the player object while the left and right arrow keys are held down for side-scrolling movement.

However, I have yet to figure out how to use this same method for jumping and gravity. I know being able to jump would be running an event that occurs after hitting a certain key, which takes in the current Y-coordinate of the player and runs it through a parabolic formula. And then gravity would simply be constantly subtracting from (or I guess in Fusion's case, adding to) the current Y-value of the player object while the frame is running. So the question simply is where and how do I implement these things in order to create jumping and gravity. I figure there's a correct syntax for a parabolic formula when creating an event after "jump" is pressed, but for the life of me I can't figure it out. As for gravity, I'm completely lost. I have managed to get down stopping movement when colliding when another object so that is not an issue.

It sounds like you want to implement your own physics instead of using what's built in. Fortunately, you don't have do any kind of parabolic calculation when jumping (unless you want to project the path of the character or something like that). Instead, you let physics run its course which will naturally create parabolic shapes. Here is some example code for very simple physics:

Vector2 velocity = Vector2.new(0, 0);
Vector2 acceleration = Vector2.new(0, 0);
bool onGround = true;

function onJump() {
velocity.Y = jumpVelocity;
onGround = false;
}

function onLand() {
velocity.Y = 0;
onGround = true;
}

function update(delta) {
if(!onGround) {
acceleration = Vector2.new(0, -gravity);
} else {
acceleration = Vector2.new(0, 0);
}

velocity += acceleration * delta;
character.position += velocity * delta;
}


What's fun is that you can use this same thing for your lateral velocity as well. Instead of merely shifting the character over by a set amount, you can just adjust the velocity in the X direction and the update loop will take care of updating the position.

This is by no means a complete physics system, but should be a good start if you want to implement physics yourself.