Moving and "vision"

I have two questions but they are fairly related so I figured one post would be enough.



Below is an image of the game I am working on. As you can see I have a blue grid and some green obstacles. I would like to have some yellow pawns which can navigate one square at a time.




  1. how would I move a box shape from 1,2,1 to 1,2,2?

    I am looking for a way of doing this so that it looks fluid (like a gradual movement to the next position). Using a local translation just teleports it my box there. Also, I’m working with in a method move that belongs to Class pawn.


  2. what is the most efficient way to check to see if the spot where your moving to is already filled by some other object?

    my initial idea was to implement an array that will keep track of all the objects and their locations and then check those arrays each time a move is made to see if its a legal move.

1 - use FastMath.interpolateLinear(float amount, Vector3f initial, Vector3f destination) where amount increases from 0 ->1 in an update(float tpf) function.



2 - this is similar to another thread i saw like a day ago. Normen suggests using a HashMap for any locations which are already taken, because an array with a lot of empty spaces is a waste, but because your grids are quite small, an array won’t really make a difference. But to be scalable a HashMap maybe the better option