summaryrefslogtreecommitdiff
path: root/src/engine.cpp
diff options
context:
space:
mode:
authorGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-27 19:05:07 +0000
committerGuillaume Melquiond <guillaume.melquiond@gmail.com>2006-08-27 19:05:07 +0000
commit6f6d061b23c6c70c632fb3ec6aa3735325f701e0 (patch)
treea0d57853d826ebca0abe9ec86973c64bec688427 /src/engine.cpp
parenta544d1b3bf1d133d5877aa97d59d7128555e69fc (diff)
downloadMana-6f6d061b23c6c70c632fb3ec6aa3735325f701e0.tar.gz
Mana-6f6d061b23c6c70c632fb3ec6aa3735325f701e0.tar.bz2
Mana-6f6d061b23c6c70c632fb3ec6aa3735325f701e0.tar.xz
Mana-6f6d061b23c6c70c632fb3ec6aa3735325f701e0.zip
Implemented pixel-grained movements.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r--src/engine.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/engine.cpp b/src/engine.cpp
index f3aff6ce..eda154f3 100644
--- a/src/engine.cpp
+++ b/src/engine.cpp
@@ -176,8 +176,8 @@ void Engine::draw(Graphics *graphics)
}
}
- camera_x = map_x / 32;
- camera_y = map_y / 32;
+ camera_x = map_x;
+ camera_y = map_y;
// Draw tiles and sprites
if (mCurrentMap != NULL)
@@ -202,11 +202,11 @@ void Engine::draw(Graphics *graphics)
int mouseX, mouseY;
SDL_GetMouseState(&mouseX, &mouseY);
- int mouseTileX = mouseX / 32 + camera_x;
- int mouseTileY = mouseY / 32 + camera_y;
+ int mouseTileX = (mouseX + map_x) / 32;
+ int mouseTileY = (mouseY + map_y) / 32;
Path debugPath = mCurrentMap->findPath(
- player_node->mX, player_node->mY,
+ player_node->mX / 32, player_node->mY / 32,
mouseTileX, mouseTileY);
graphics->setColor(gcn::Color(255, 0, 0));