Tiles are 32x32 pixels, if i move the character by 32 pixels like in this piece of code the characters moves too roughly but if i move him by less pixels he can stay in middle of 2 tiles. Can someone give some pseudo code to orientate me? Thanks
int TILESIZE = 32;
Input input = container.getInput();
if (input.isKeyDown(Input.KEY_W) && Y != 0) {
Y -= Game.TILESIZE;// moves the sprite by 32 pixel up
Movement.update(delta);//updates animation
}else if (input.isKeyDown(Input.KEY_A) && X != 0) {
X -= Game.TILESIZE;
Movement.update(delta);
}else if (input.isKeyDown(Input.KEY_D) && X != Game.MapLimitX) {
X += Game.TILESIZE;
Movement.update(delta);
}else if (input.isKeyDown(Input.KEY_S) && Y != Game.MapLimitY) {
Y += Game.TILESIZE;
Movement.update(delta);
}