Working on an isometric engine - Need help with movement design

Can anybody point me to a guide for a tile based movement system, or just give me some tips?
I have the isometric graphics all setup, i just need an idea to get the real tile based movements, no free point type thing.
Do you know what I mean? Where when you let go of the arrow, it continues to move until it hits a spot. I have ideas, but I need more help.
Im thinking I can put a timer into play and check periodically if the character is in a tile, and only set the dx && dy to 0 if the key is released AND he is exactly in a tile coordinate. If anybody has tips or a completely different idea.
Any help would be appreciated,

This moves a unit 1 tile at a time while the user holds a button. The unit is moved pixel by pixel between tiles over a 1000ms period.


// update code
unit.moveTimer -= delta
if (unit.moveTimer <= 0) {
	unit.moveTimer = 0
	unit.column = unit.moveColumn
	unit.row = unit.moveRow
}
if (unit.moveTimer == 0) {
	if (appropriate key pressed) {
		unit.moveTimer = 1000
		unit.moveColumn = targetColumn
		unit.moveRow = targetRow
	}
}
.
.
.
// drawing code
float percent = unit.moveTimer / 1000f
int x = unit.column * tileWidth
x += (unit.column - unit.moveColumn) * percent
int y = unit.row * tileHeight
y += (unit.row - unit.moveRow) * percent
unit.draw(x, y)

Note your unit will occupy 2 tiles at once as it moves. For hit detection purposes, you can use unit.column/row if percent < 0.5 and unit.moveColumn/Row if percent >= 0.5.

Not sure if this applies for you (it’s possible you’re already doing it), but a great rule of thumb with any graphical transformations is to keep all the logic untransformed, and only transform things that are drawn. In an isometric sense, this means that you’re representing a simple 2D array in memory, so to move to the up/left tile that’s just moving - on the X axis. Then when you draw it, you rotate everything 45º and then squish the Y (i.e. do the isometric transformation only when drawing). Also, you’ll need to translate mouse input backwards (from isometric to non-isometric).

http://lmgtfy.com/?q=isometric+game
2nd hit:
http://www.gamedev.net/reference/list.asp?categoryid=44

GameDev should be among your 1st go to point for nearly anything game related.

Is there any chance I can get you to describe what this code does, a bit more detailed? :slight_smile:
I’m having the exact same problem, but for a standard 2D-tile system. What is delta, and what do the methods in unit do? Move 1px? :slight_smile:

as Eli said.

I struggled for a while having my logic work in the isometric perspective. I have another thread open at the moment with what Ive learned.

doing all the movement login in cartesian world-space and then transforming to isometric screen space is the way to go I think.