]> git.localhorst.tv Git - l2e.git/blobdiff - src/main.cpp
fix blocking flag of guy
[l2e.git] / src / main.cpp
index 745ec4bcdda5ddce953ad513f6f15dfd28ca80e7..bf57b848a280d12fbb94b8b0ed179e18e211e24b 100644 (file)
@@ -334,25 +334,46 @@ 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<float>(80, 128);
+               mapMaxim.Position() = Vector<float>(64, 128);
+               mapMaxim.SpriteOffset() = Vector<float>(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<float>(64, 128);
+               mapSelan.SpriteOffset() = Vector<float>(0, -32);
+               mapSelan.SetFlags(Entity::FLAG_NONBLOCKING);
+               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<float>(64, 128);
+               mapGuy.SpriteOffset() = Vector<float>(0, -32);
+               mapGuy.SetFlags(Entity::FLAG_NONBLOCKING);
+               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<float>(64, 128);
+               mapDekar.SpriteOffset() = Vector<float>(0, -32);
+               mapDekar.SetFlags(Entity::FLAG_NONBLOCKING);
+               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<float>(64, 32);
+               mapMonster.SetOrientation(Entity::ORIENTATION_SOUTH);
 
                InitScreen screen(width, height);
 
@@ -371,9 +392,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;
                }