Slide 26
Slide 26 text
37,32 69,32
69,64
37,64
float currentX = playerSprite.getX();
float currentY = playerSprite.getY();
float newX = currentX;
float newY = currentY;
if(Gdx.input.isKeyPressed(Input.Keys.RIGHT)) {
newX += moveAmount;
}
if(checkIfInWall(newX, newY)) {
playerSprite.setPosition(newX, newY);
}