I am a bit new to Java. In the forLoop below, I am looping over the elements of the arraylist and I am trying to change the position object. When the forLoop is finished, th
Ahhhh I see the problem... It is in the class PositionedTexture. You are not creating a new Position for each Button. So basically all the Buttons position point to the Vector2.Zero.
Creating a new Position element is the way to go...
public class PositionedTexture {
public Texture Texture;
public Vector2 Position;
public PositionedTexture(String texturePath) {
Texture = new Texture(Gdx.files.internal(texturePath));
Position = Vector2.Zero;
}
public PositionedTexture(String texturePath, Vector2 position) {
Texture = new Texture(Gdx.files.internal(texturePath));
Position = position;
}
Make sure that you didn't put the same instance of the object in all positions of the array list - in other words add the same element over and over again. That's what would probably cause the behavior you're seeing.