I am generally new to both Java and Slick2D, and even after browsing Google, I couldn't find the answer to my question. In my game I have a character that can currently run back and forth, and jump. I want him to be able to shoot projectiles, but the way I have it coded, the projectile changes trajectory when he switches direction or jumps.
if(input.isKeyPressed(Input.KEY_SPACE)){
shotX = charPosX;
shotY = charPosY;
if(left){
shotX += delta * -0.5f;
}else{
shotX +=delta * 0.5f;
}
}
This is basically the code I currently have. The "left" boolean simply states whether the character is facing left or right. I feel like I'm missing something obvious, but I was wondering if anyone had a simple solution to this, perhaps a way to stop setting the shot's position to the the character's position after it is rendered. Any help is appreciated.