Exemplo n.º 1
0
        public World()
        {
            OverWorld = new MainMap();
            MapGenerator mg = new MapGenerator();

            OverWorld = mg.NewMap();

            SmallMap = new List<Map>();
            Name = "New World";

            SpawnPlaceMapType = (int)MapType.MainMap;
            SpawnMapX = 0;
            SpawnMapY = 0;
            SpawnMapIndex = 0;
        }
        static void Main()
        {
            // Create the main window
               CurrentSaveData = 0;
               Data d = new Data();
               Data = d;

               d.CreateTerrain();
               d.CreateSpriteData();
               d.CreateTileData();
               d.CreateItems();
               d.CreateSpawnable();

               List<GameState> _gameState = new List<GameState>();
               State = _gameState;

               MainMap m;
               MouseState = 0;
               InState = 0;
               MapGenerator mg = new MapGenerator();
               m = mg.NewMap();

               MyMap = m;
               Generator = mg;

               d.CreateLivingObjectData();

               PlayerData test = new PlayerData();
               test.MainParty.AddMember(((NPC)d.MyLivingObject[0]));
               d.MyPlayerData.Add(test);
               d.MyPlayerData[CurrentSaveData].MainParty.MyParty[0].Inventory[0] = new SpawnItems(0);
               d.MyPlayerData[CurrentSaveData].MainParty.MyParty[0].Inventory[1] = new SpawnItems(1);
               d.MyPlayerData[CurrentSaveData].MainParty.MyParty[0].Inventory[2] = new SpawnItems(1);
               //d.MyPlayerData[Program.CurrentSaveData].MainParty.MyParty[0].EquipItems(1);
               d.MyPlayerData[CurrentSaveData].MainParty.AddMember((NPC)d.MyLivingObject[1]);

               Font font = new Font("Georgia.ttf");
               List<string> stuff = new List<string>();

              RenderWindow Screen = new RenderWindow(new VideoMode(1040, 768), "Wandering Soul - The Legacy");
              RW = Screen;
              Screen.SetFramerateLimit(60);
              Screen.Closed += new EventHandler(OnClose);
              Screen.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
              Screen.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(OnMousePress);
              Screen.MouseMoved += new EventHandler<MouseMoveEventArgs>(OnMouseMove);
               Screen.MouseButtonReleased += new EventHandler<MouseButtonEventArgs>(OnMouseRelease);

               Screen.SetMouseCursorVisible(false);

              _gameState.Add(new MainMenuState(Screen));
              _gameState.Add(new InGameState(Screen, 0));

              Color windowColor = new Color(0, 0, 0);

              Text t;
              SFML.Graphics.Sprite s;

              // Start the game loop
              while (Screen.IsOpen()) {
             // Process events

              stuff.Clear();
              string ministuff = "";
              foreach (Terrain ter in MyMap.SpawnedTerrain)
              {
              ministuff = "";
              ministuff += ter.MinHorizontal + ", " + ter.MaxHorizontal + ", " + ter.MinVertical + ", " + ter.MaxVertical;
              stuff.Add(ministuff);
              }

             Screen.DispatchEvents();

             // Clear screen
             Screen.Clear(windowColor);

             _gameState[InState].Update();
             _gameState[InState].Draw();

             /*for (int i = 0; i < stuff.Count; i++)
             {
             t = new Text(stuff[i], font);
             t.Position = new Vector2f(50, i * 20 + 50);
             Screen.Draw(t);
             }*/

             //t = new Text("Min X: " + MyMap.MinX + ", Min Y: " + MyMap.MinY + ", Max X: " + MyMap.MaxX + ", Max Y: " + MyMap.MaxY + ", " + MyMap.SpawnedTerrain[0].Size.ToString() + ", Spawned Terrain Count: " + MyMap.SpawnedTerrain.Count, font);
             //t.Position = new Vector2f(0, 0);
             //Screen.Draw(t);
             t = new Text("X: " + (Mouse.GetPosition(Screen).X / 16 + Program.Data.MyPlayerData[CurrentSaveData].MainParty.MyParty[0].X - Screen.Size.X / 2 / 16 - 1) + ", Y: " + ((Mouse.GetPosition(Screen).Y + 8) / 16 + Program.Data.MyPlayerData[CurrentSaveData].MainParty.MyParty[0].Y - Screen.Size.Y / 2 / 16 - 1), Program.Data.Font);
            Screen.SetView(new View(new FloatRect(0, 0, Screen.Size.X, Screen.Size.Y)));
            t.Position = new Vector2f(0, 0);
            Screen.Draw(t);

              s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Mouse)[MouseState]);
              switch ((MouseStateType)MouseState)
              {
              case MouseStateType.Normal:
                  s.Position = new Vector2f(Mouse.GetPosition(Screen).X - 3, Mouse.GetPosition(Screen).Y);
                  break;
              case MouseStateType.Dragging:
                  s.Position = new Vector2f(Mouse.GetPosition(Screen).X - 2, Mouse.GetPosition(Screen).Y + 3);
                  break;
              }
              Screen.Draw(s);
             // Update the window
             Screen.Display();
              } //End game loop
        }
Exemplo n.º 3
0
        static void Main()
        {
            // Create the main window
               CurrentSaveData = 0;
               Data d = new Data();
               Data = d;

               d.CreateGraphicPath();
               d.CreateTerrain();
               d.CreateSpriteData();
               d.CreateTileData();
               d.CreateAnimation();
               d.CreateAttack();
               d.CreateItems();
               d.CreateSpawnable();
               d.CreateKnowledge();
               d.CreateFaceData();
               d.CreateBodyData();
               d.CreateHairData();
               d.CreateTileVariation();
               d.LoadPlayerData();
               d.LoadWorldData();

               List<GameState> _gameState = new List<GameState>();
               State = _gameState;

               MainMap m;
               MouseState = 0;
               InState = 0;
               MapGenerator mg = new MapGenerator();
               m = mg.NewMap();

               MyMap = m;
               Generator = mg;

               Font font = new Font("Georgia.ttf");
               List<string> stuff = new List<string>();

               RenderWindow Screen = new RenderWindow(new VideoMode(1040, 768), "Wandering Soul - The Legacy");
               VisibleMaxX = 1040 / 16;
               VisibleMaxY = 768 / 16;
               RW = Screen;
               Screen.SetFramerateLimit(60);
               Screen.Closed += new EventHandler(OnClose);
               Screen.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
               Screen.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(OnMousePress);
               Screen.MouseMoved += new EventHandler<MouseMoveEventArgs>(OnMouseMove);
               Screen.MouseButtonReleased += new EventHandler<MouseButtonEventArgs>(OnMouseRelease);
               Screen.Resized +=new EventHandler<SizeEventArgs>(OnScreenResize);

               Screen.SetMouseCursorVisible(false);

               _gameState.Add(new MainMenuState(Screen));
               _gameState.Add(new InGameState(Screen));

               Color windowColor = new Color(0, 0, 0);

               Text t;
               SFML.Graphics.Sprite s;

               // Start the game loop
               while (Screen.IsOpen()) {
             // Process events

             Screen.DispatchEvents();

             // Clear screen
             Screen.Clear(windowColor);

             _gameState[InState].Update();
             _gameState[InState].Draw();

             /*for (int i = 0; i < stuff.Count; i++)
             {
             t = new Text(stuff[i], font);
             t.Position = new Vector2f(50, i * 20 + 50);
             Screen.Draw(t);
             }*/

             //t = new Text("Min X: " + MyMap.MinX + ", Min Y: " + MyMap.MinY + ", Max X: " + MyMap.MaxX + ", Max Y: " + MyMap.MaxY + ", " + MyMap.SpawnedTerrain[0].Size.ToString() + ", Spawned Terrain Count: " + MyMap.SpawnedTerrain.Count, font);
             //t.Position = new Vector2f(0, 0);
             //Screen.Draw(t);

             Screen.SetView(new View(new FloatRect(0, 0, Screen.Size.X, Screen.Size.Y)));

             s = new SFML.Graphics.Sprite(Program.Data.SpriteBasedOnType(SpriteType.Mouse)[MouseState]);
             switch ((MouseStateType)MouseState)
             {
             case MouseStateType.Normal:
                 s.Position = new Vector2f(Mouse.GetPosition(Screen).X - 3, Mouse.GetPosition(Screen).Y);
                 break;
             case MouseStateType.Dragging:
                  s.Position = new Vector2f(Mouse.GetPosition(Screen).X - 2, Mouse.GetPosition(Screen).Y + 3);
                  break;
             }
             Screen.Draw(s);
             // Update the window
             Screen.Display();
              } //End game loop
        }