[Slick2D] Movement Trouble

I’m trying to get my player to move smoothly. In my game though he is really jumpy and it just doesnt look smooth. here’s me code:

public void update(GameContainer gc, StateBasedGame sbg, int delta) {
		Input input = gc.getInput();
		
		x += velX;
		
		if(input.isKeyDown(Input.KEY_RIGHT)) {
			velX = delta * .1f;
		}else if(input.isKeyDown(Input.KEY_LEFT)) {
			velX = -(delta * .1f);
		}else{
			velX = 0;
		}
	}

Delta-step loops don’t play well with acceleration.

haha ya I fixed it. The correct code:


import org.newdawn.slick.GameContainer;
import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;
import org.newdawn.slick.Input;
import org.newdawn.slick.SlickException;
import org.newdawn.slick.state.StateBasedGame;

public class Player {

	float x = 100;
	float y = 100;
	
	double velX = 0;
	double velY = 0;
	
	Image sprite;
	
	public Player() {
		try {
			sprite = new Image("res/ZN_Idle.png");
		} catch (SlickException e) {
			e.printStackTrace();
		}
	}
	
	public void render(Graphics g) {
		g.drawImage(sprite, (int)x, (int)y);
	}
	
	public void update(GameContainer gc, StateBasedGame sbg, int delta) {
		Input input = gc.getInput();
		
		x += velX;
		
		if(input.isKeyDown(Input.KEY_RIGHT)) {
			velX = .13;
		}else if(input.isKeyDown(Input.KEY_LEFT)) {
			velX = -.13;
		}else{
			velX = 0;
		}
	}
	
}