How to make a little fight jump?

;D Hi,

I’m doing a Little Fighter style game and I’m having trouble with the jump.

I have the following code:


public class Jump{
	
	MainGame game;
	Rectangle player, shadown;    //Rectangle of shadown and player
	boolean inJump = false;         //Stop jump 
	float positionY;                     // Position of the character
	float velocityY;                     // Velocity of the character
	float gravity = -450f;            // How strong is gravity
        float initialJump = 0;

	public Jump(MainGame game, Rectangle player, Rectangle shadow) {
		super();
		this.game = game;
		this.player = player;
		this.shadow = shadow; 
	}
	
	
	public void upgrade(float delta){
		
		if (inJump) {
			
			if(positionY <= initialJump){
				stop();
			} else {
				player.setPosition(player.x, positionY);
				positionY += velocityY * 0.02f;      // Apply vertical velocity to X position
			 	velocityY += gravity * 0.02f;        // Apply gravity to vertical velocity   
			}
			
			
		}

			
		game.debugRender.begin(ShapeType.Filled);
		game.debugRender.setColor(Color.GREEN);
		game.debugRender.rect(player.x,player.y, player.width, player.height);
		game.debugRender.setColor(Color.BLACK);
		game.debugRender.rect(sombra.x, sombra.y, sombra.width, sombra.height);
		game.debugRender.end();
		    
	  
	}

	public void OnJumpKeyPressed()
	{
		if (inJump != true) {
			initialJump = shadown.y + sombra.height;     //Position the start of the jump on the platform / rectangle, shadow              
			positionY = player.getY() + 1;                      //Initial positionY 
			emPulo = true;                //Started jump
			velocityY = 300.0f;           //Give a vertical boost to the players velocity to start jump	
		}
		
		
	}
	
	
	//Para o pulo 
	void stop(){
	     inJump= false;
	    velocityX = 0;        
	    player.setPosition(player.x, inicialPulo);
	}



This works well on a fixed platform, But my platform moves, In case my platform is the shadow.

I’m trying to make this jump:

My projec testt xD

:slight_smile: thank for help ;D

:frowning: I already got it, thank you very much.