X-Git-Url: http://git.localhorst.tv/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain.cpp;h=c1b70af05f1dc492d717c17679a11150fe659285;hb=e6ba365d8f4b261687d4947d6b78f08c7fda1cdb;hp=20eb55b4adf4aa9f61dbd2cb9ea91da21579817a;hpb=c055b357c50dd871b49c38191a9d867ff42ea420;p=l2e.git diff --git a/src/main.cpp b/src/main.cpp index 20eb55b..c1b70af 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -334,7 +334,43 @@ int main(int argc, char **argv) { SimpleAnimation mapMaximAnimation(&mapMaximSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); Entity mapMaxim; mapMaxim.SetAnimation(&mapMaximAnimation); - mapMaxim.Position() = Vector(80, 128); + mapMaxim.Position() = Vector(64, 128); + mapMaxim.SpriteOffset() = Vector(0, -32); + + SDL_Surface *mapSelanImg(IMG_Load("test-data/selan-map.png")); + Sprite mapSelanSprite(mapSelanImg, 32, 64); + SimpleAnimation mapSelanAnimation(&mapSelanSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapSelan; + mapSelan.SetAnimation(&mapSelanAnimation); + mapSelan.Position() = Vector(64, 128); + mapSelan.SpriteOffset() = Vector(0, -32); + mapMaxim.AddFollower(&mapSelan); + + SDL_Surface *mapGuyImg(IMG_Load("test-data/guy-map.png")); + Sprite mapGuySprite(mapGuyImg, 32, 64); + SimpleAnimation mapGuyAnimation(&mapGuySprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapGuy; + mapGuy.SetAnimation(&mapGuyAnimation); + mapGuy.Position() = Vector(64, 128); + mapGuy.SpriteOffset() = Vector(0, -32); + mapSelan.AddFollower(&mapGuy); + + SDL_Surface *mapDekarImg(IMG_Load("test-data/dekar-map.png")); + Sprite mapDekarSprite(mapDekarImg, 32, 64); + SimpleAnimation mapDekarAnimation(&mapDekarSprite, (tileSize/walkSpeed) / 2 * 1000, 2, 0, 0, true); + Entity mapDekar; + mapDekar.SetAnimation(&mapDekarAnimation); + mapDekar.Position() = Vector(64, 128); + mapDekar.SpriteOffset() = Vector(0, -32); + mapGuy.AddFollower(&mapDekar); + + SDL_Surface *mapMonsterImg(IMG_Load("test-data/monster-map.png")); + Sprite mapMonsterSprite(mapMonsterImg, 32, 32); + SimpleAnimation mapMonsterAnimation(&mapMonsterSprite, 500, 2, 0, 0, true); + Entity mapMonster; + mapMonster.SetAnimation(&mapMonsterAnimation); + mapMonster.Position() = Vector(64, 32); + mapMonster.SetOrientation(Entity::ORIENTATION_SOUTH); InitScreen screen(width, height); @@ -353,9 +389,18 @@ int main(int argc, char **argv) { state = battleState; } else { MapState *mapState(new MapState(&map)); + mapState->AddEntity(&mapMaxim); + mapState->AddEntity(&mapSelan); + mapState->AddEntity(&mapGuy); + mapState->AddEntity(&mapDekar); + mapState->ControlEntity(&mapMaxim); mapState->SetWalkingSpeed(walkSpeed); + + mapState->AddEntity(&mapMonster); + mapMonster.StartAnimation(*mapState); + state = mapState; }