From: Daniel Karbach Date: Tue, 2 Oct 2012 20:25:38 +0000 (+0200) Subject: shift walking animation by one frame X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=f0da7a839b18b9860fad1c62f36003628f84b5b3;p=l2e.git shift walking animation by one frame --- diff --git a/src/main.cpp b/src/main.cpp index 1979aac..aa20890 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -94,6 +94,7 @@ int main(int argc, char **argv) { const int width = 800; const int height = 480; + const int tileSize = 32; const float walkSpeed = 128.0f; const bool battle(false); @@ -315,7 +316,7 @@ int main(int argc, char **argv) { area.SetWidth(8); SDL_Surface *tilesetImg(IMG_Load("test-data/tileset.png")); - Sprite tileset(tilesetImg, 32, 32); + Sprite tileset(tilesetImg, tileSize, tileSize); Map map; map.SetAreas(&area, 1); @@ -324,7 +325,7 @@ int main(int argc, char **argv) { SDL_Surface *mapMaximImg(IMG_Load("test-data/maxim-map.png")); Sprite mapMaximSprite(mapMaximImg, 32, 64); - SimpleAnimation mapMaximAnimation(&mapMaximSprite, 128, 2, 0, 0, true); + SimpleAnimation mapMaximAnimation(&mapMaximSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); Entity mapMaxim; mapMaxim.SetAnimation(&mapMaximAnimation); mapMaxim.Position() = Vector(80, 128); diff --git a/src/map/Entity.cpp b/src/map/Entity.cpp index 302ce5c..b9fba97 100644 --- a/src/map/Entity.cpp +++ b/src/map/Entity.cpp @@ -15,7 +15,7 @@ Entity::Entity() : animation(0) , orientation(ORIENTATION_NORTH) , speed(0) { - + runner.SetFrameShift(1); }