Alright, so I have this for loop that iterates constantly through all the ships and checks for stuff and what not. I want to be able to select a ship just by checking if it’s hovered. So far selecting works, but it also seems that as soon as I click the ship and set the currentShip to the clicked ship, the currentShip gets set back to null instantly. How do I keep currentShip from getting set back to null after I click the object?
if (ship.isHovered() && Gdx.input.isButtonPressed(Buttons.LEFT) && ship.getFaction() == 1) {
currentShip = ship;
updateFollowCamera(camera);
}
if(Gdx.input.isButtonPressed(Buttons.LEFT) && ship.isHovered() == false && currentShip != null){
currentShip = null;
}