What jumps from A to B when what is clicked?
I’m trying to say when I want the bullet to shoot at the mouse after one mouse click
So use InputProcessor:
@Override
public boolean touchDown (int x, int y, int pointer, int button) {
if (button == Buttons.LEFT) {
Entity ball = new Entity(cannonBallTexture);
entities.add(ball);
return true;
}
return false;
}
Wasn’t too sure where to use that method. I removed the pointer parameter because I don’t know what to put in it. I used it and still no change in results
touchDown(Gdx.input.getX(), Gdx.input.getY(), 0);
You don’t call it yourself, and you can’t change the method signature.
If you read the libGDX wiki page I linked, you would see this:
Gdx.input.setInputProcessor(inputProcessor);
[quote]From this point on, all new input events will be pushed to the MyInputProcessor instance. Events are dispatched right before the call to ApplicationListener.render(), on the rendering thread.
[/quote]
Just make your TestScreen implement InputProcessor, and set it as the main event handler.
Unnecessary, I figured it out. Another lesson learned, read the code. I just had to comment this part of the Entity class.
if (!screenBounds.contains(position.x, position.y))
reset();
so it wouldn’t reset.