Beispiel #1
0
        private void Initilize()
        {
            spritebatch   = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List <Vector2> path = pathfinder.FindPath(new Point(3, 2), new Point(9, 8));

            spriteManager.AddSprite(new Human(
                                        contentManager.Load <Texture2D>(@"Sprites/player"),
                                        new Point(42, 42),
                                        new Vector2(32 * 3, 32 * 3),
                                        Vector2.Zero,
                                        10, 0, movedata, sceneManager,
                                        new Poop(contentManager.Load <Texture2D>(@"Sprites/poop"))));

            spriteManager.AddSprite(new ComputerAI(
                                        contentManager.Load <Texture2D>(@"Sprites/player"),
                                        new Point(42, 42),
                                        new Vector2(32 * 3, 32 * 3),
                                        Vector2.Zero,
                                        10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            foreach (Vector2 point in path)
            {
                Console.WriteLine(point);
            }

            //sceneManager.Game.Components.Add(spriteManager);
            //monsterSprite = new Sprite(32*3,32*3,0,contentManager,graphicsDevice,movedata);
            //line = new Texture2D(_graphicsDevice, 1, 1);
            //line.SetData(new[] { Color.Black });
        }
Beispiel #2
0
        private void Initilize()
        {
            spritebatch   = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List <Vector2> path = pathfinder.FindPath(new Point(1, 1), new Point(10, 1));

            foreach (Vector2 point in path)
            {
                //Console.WriteLine("Path: " + point);
            }

            foreach (Vector2 point in path)
            {
                AIPos = new Vector2(point.X, point.Y);
                //Console.WriteLine("AI: " + AIPos);
                break;
            }

            /*
             * foreach (Vector2 point in tempPath)
             * {
             *  AIPos = new Vector2((point.X / 48) % 16, (point.Y / 48) % 16);
             *  Console.WriteLine("AI: " + AIPos);
             *  break;
             * }
             *
             * foreach (Vector2 point in tempPath)
             * {
             *  int pointX = (int)point.X;
             *  int pointY = (int)point.Y;
             *  int tempX, tempY;
             *
             *  if (((point.X % 48) != 0) || (((point.Y % 48) != 0)))
             *  {
             *      tempX = (int)(point.X % 48);
             *      tempY = (int)(point.Y % 48);
             *
             *      Console.WriteLine("point = {X:" + pointX + " Y:" + pointY + "} X = " + tempX + " Y = " + tempY);
             *
             *      if (tempX == 32)
             *          pointX += 16;
             *
             *      if (tempX == 16)
             *          pointX -= 16;
             *
             *      if (tempY == 32)
             *          pointY += 16;
             *
             *      if (tempY == 16)
             *          pointY -= 16;
             *
             *      path.Add(new Vector2(pointX, pointY));
             *  }
             * }
             */

            Human h1 = new Human(
                contentManager.Load <Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(48, 48),
                Vector2.Zero,
                10, 0, movedata, sceneManager);

            spriteManager.AddSprite(h1);
            Console.WriteLine("TESSSSSSSSSST");
            MonsterStatus ms = new MonsterStatus(0, 0, 0, @"Monster One");

            M1 = new Monster(ms, ref h1, spriteManager);

            spriteManager.AddSprite(new ComputerAI(
                                        contentManager.Load <Texture2D>(@"Sprites/player"),
                                        new Point(42, 42),
                                        AIPos,
                                        Vector2.Zero,
                                        10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            line = new Texture2D(_graphicsDevice, 1, 1);
            line.SetData(new[] { Color.Black });
        }
Beispiel #3
0
 private void ExePoop(ArrayList paramaters)
 {
     SM.AddSprite(new Poop((Vector2)paramaters[0]));
 }
Beispiel #4
0
        private void Initilize()
        {
            spritebatch = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List<Vector2> path = pathfinder.FindPath(new Point(3, 2), new Point(9, 8));

            spriteManager.AddSprite(new Human(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(32 * 3, 32 * 3),
                Vector2.Zero,
                10, 0, movedata, sceneManager,
                new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"))));

            spriteManager.AddSprite(new ComputerAI(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(32 * 3, 32 * 3),
                Vector2.Zero,
                10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            foreach (Vector2 point in path)
            {
                Console.WriteLine(point);
            }

            //sceneManager.Game.Components.Add(spriteManager);
            //monsterSprite = new Sprite(32*3,32*3,0,contentManager,graphicsDevice,movedata);
            //line = new Texture2D(_graphicsDevice, 1, 1);
            //line.SetData(new[] { Color.Black });
        }
Beispiel #5
0
        private void Initilize()
        {
            spritebatch = new SpriteBatch(_graphicsDevice);
            spriteManager = new SpriteManager(spritebatch, graphicsDevice, contentManager);

            pathfinder = new Pathfinder(this);
            List<Vector2> path = pathfinder.FindPath(new Point(1, 1), new Point(10, 1));

            foreach (Vector2 point in path)
            {
                //Console.WriteLine("Path: " + point);
            }

            foreach (Vector2 point in path)
            {
                AIPos = new Vector2(point.X, point.Y);
                //Console.WriteLine("AI: " + AIPos);
                break;
            }

            /*
            foreach (Vector2 point in tempPath)
            {
                AIPos = new Vector2((point.X / 48) % 16, (point.Y / 48) % 16);
                Console.WriteLine("AI: " + AIPos);
                break;
            }

            foreach (Vector2 point in tempPath)
            {
                int pointX = (int)point.X;
                int pointY = (int)point.Y;
                int tempX, tempY;

                if (((point.X % 48) != 0) || (((point.Y % 48) != 0)))
                {
                    tempX = (int)(point.X % 48);
                    tempY = (int)(point.Y % 48);

                    Console.WriteLine("point = {X:" + pointX + " Y:" + pointY + "} X = " + tempX + " Y = " + tempY);

                    if (tempX == 32)
                        pointX += 16;

                    if (tempX == 16)
                        pointX -= 16;

                    if (tempY == 32)
                        pointY += 16;

                    if (tempY == 16)
                        pointY -= 16;

                    path.Add(new Vector2(pointX, pointY));
                }
            }
            */

            Human h1 = new Human(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                new Vector2(48, 48),
                Vector2.Zero,
                10, 0, movedata, sceneManager);
            spriteManager.AddSprite(h1);
            Console.WriteLine("TESSSSSSSSSST");
            MonsterStatus ms = new MonsterStatus(0, 0, 0, @"Monster One");
            M1 = new Monster(ms, ref h1, spriteManager);

            spriteManager.AddSprite(new ComputerAI(
                contentManager.Load<Texture2D>(@"Sprites/player"),
                new Point(42, 42),
                AIPos,
                Vector2.Zero,
                10, 0, movedata, sceneManager, path));

            //spriteManager.AddSprite(new Poop(contentManager.Load<Texture2D>(@"Sprites/poop"), new Vector2(50 * 3, 50 * 3)));

            line = new Texture2D(_graphicsDevice, 1, 1);
            line.SetData(new[] { Color.Black });
        }