# How do I move a sprite around using tile based movement in Java?

So, I'm new to Java and I want to get a sprite to move around the screen, like a tile-based movement. I really would like some help and some resources or tutorials could work. I've done a little C#, but I couldn't seem to get it.

Might as well learn it from Stanford right? The video lectures there are rather good for someone just starting out. You'll use Karol the Robot as your guide to learning to program. Once you get more comfortable with the higher level concepts you can dig into the source for Karol and learn how actually do the drawing and moving around.

This is relatively a language independent question. though my java is a little light, but the logic is the big thing here.

Tile systems are relatively straight forward, but still equally as difficult as continuous motion, in that instead of incrementing with respect to time

x += 5*time;

x += tileWidth;

so for example if you have a character that holds a position you would just have.

if(button.press.up){
character.position.y -= tileHeight;
}
if(button.press.left){
character.position.x += tileWidth;
}


and the reverse for the other directions. the big thing here is instead of moving with respect to time, or some counting your moving with respect to fixed numbers. though this is primarily for rectangular tiles (square if tileHeight = tileWidth). if your doing different shape tiles (hexagonal, triangular, etc...) then your going to have different math, but the concept of moving at fixed increments is the key here.