Esempio n. 1
0
        public override void LoadContent(Player player, MapBase theMap)
        {
            base.LoadContent(player, theMap);

            player.MapBoundry = MapBoundry;

            MapTiles = new DungeonTiles(Game1.Textures["dungeonTiles"]);

            datasource = new TileLayoutDataSource(@"Map\Dungeon1TileLayout.csv", MapTiles);
            datasource.LoadContent();

            Texture2D playerTexture = Game1.Textures["player"];

            textBox = new TextBox(Game1.gameFont, Game1.Textures["textBox"]);

            testCharacter = new Enemy(Game1.Textures["blackKnight"], new Vector2(175, 350), theMap, MapBoundry);
            enemy2 = new Enemy(Game1.Textures["blackKnight"], new Vector2(550, 350), theMap, MapBoundry);

            basicSword = new Sword("Basic Sword", Game1.Textures["sword"], new Vector2(200, 300), ItemType.Weapon, true);

            swordChest = new Chest(basicSword, new Vector2(400, 200), Game1.Textures["chest"]);

            MovingElements.Add(player);
            MovingElements.Add(testCharacter);

            MovingElements.Add(enemy2);
            ImmovableObjects.AddRange(datasource.GetCollisionTiles());
            ImmovableObjects.Add(swordChest);
            ItemsAvailable.Add(basicSword);
        }
Esempio n. 2
0
        public Mario(Texture2D PlayerTexture, Vector2 Position, MapBase Map, Rectangle MapBoundry)
            : base(PlayerTexture, Position, Map, MapBoundry)
        {
            movementRate = 3;

            walkFrames = new Dictionary<Direction, Tuple<Point, Point>>();
            walkFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(0, 3), new Point(4, 3)));
            walkFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 0), new Point(4, 0)));
            walkFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 1), new Point(4, 1)));
            walkFrames.Add(Direction.East,
                 new Tuple<Point, Point>(new Point(0, 2), new Point(4, 2)));

            idleFrames = new Dictionary<Direction, Tuple<Point, Point>>();
            idleFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(0, 4), new Point(0, 4)));
            idleFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 0), new Point(0, 0)));
            idleFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 2), new Point(0, 2)));
            idleFrames.Add(Direction.East,
                 new Tuple<Point, Point>(new Point(0, 3), new Point(0, 3)));
        }
Esempio n. 3
0
        public Enemy(Texture2D PlayerTexture, Vector2 Position, MapBase Map,Rectangle MapBoundry)
        {
            this.Texture = PlayerTexture;
            this.Position = Position;
            FrameSize = new Point(18, 24);
            CanCollide = true;
            theMap = Map;
            movementRate = 1;
            CharacterDirection = Direction.South;
            this.MapBoundry = MapBoundry;
            MaxHealth = 5;
            CurrentHealth = MaxHealth;

            walkFrames = new Dictionary<Direction,Tuple<Point,Point>>();
            walkFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(0, 3),new Point(4, 3)));
            walkFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 0), new Point(4, 0)));
            walkFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 1), new Point(4, 1)));
               walkFrames.Add(Direction.East,
                new Tuple<Point, Point>(new Point(0, 2), new Point(4, 2)));

            idleFrames = new Dictionary<Direction,Tuple<Point,Point>>();
            idleFrames.Add(Direction.North,
                new Tuple<Point,Point>(new Point(0, 4), new Point(0, 4)));
            idleFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 0), new Point(0, 0)));
            idleFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 2), new Point(0, 2)));
               idleFrames.Add(Direction.East,
                new Tuple<Point, Point>(new Point(0, 3), new Point(0, 3)));
        }
Esempio n. 4
0
        public Player2(Texture2D PlayerTexture, Vector2 Position, Texture2D InventoryTexture, SpriteFont HealthHUDFont, MapBase theMap)
        {
            this.Texture = PlayerTexture;
            PlayerItems = new Inventory(InventoryTexture);
            this.Position = Position;
            this.HealthHUDFont = HealthHUDFont;
            this.theMap = theMap;
            FrameSize = new Point(18, 24);
            MaxHealth = 5;
            CurrentHealth = MaxHealth;
            CanMove = true;
            showItems = false;

            movementRate = 2;

            walkFrames = new Dictionary<Direction, Tuple<Point, Point>>();
            walkFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(0, 4), new Point(4, 4)));
            walkFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 1), new Point(4, 1)));
            walkFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 2), new Point(4, 2)));
            walkFrames.Add(Direction.East,
                 new Tuple<Point, Point>(new Point(0, 3), new Point(4, 3)));

            idleFrames = new Dictionary<Direction, Tuple<Point, Point>>();
            idleFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(0, 4), new Point(0, 4)));
            idleFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(0, 0), new Point(0, 0)));
            idleFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 2), new Point(0, 2)));
            idleFrames.Add(Direction.East,
                 new Tuple<Point, Point>(new Point(0, 3), new Point(0, 3)));

            attackFrames = new Dictionary<Direction, Tuple<Point, Point>>();
            attackFrames.Add(Direction.North,
                new Tuple<Point, Point>(new Point(3, 4), new Point(3, 4)));
            attackFrames.Add(Direction.South,
                new Tuple<Point, Point>(new Point(3, 1), new Point(3, 1)));
            attackFrames.Add(Direction.West,
                new Tuple<Point, Point>(new Point(0, 2), new Point(1, 2)));
            attackFrames.Add(Direction.East,
                new Tuple<Point, Point>(new Point(3, 3), new Point(3, 3)));
        }
Esempio n. 5
0
 public virtual void LoadContent(Player player, Player2 player2, MapBase currentMap)
 {
     userPlayer = player;
     userPlayer2 = player2;
 }
Esempio n. 6
0
 public virtual void LoadContent(Player player, MapBase theMap)
 {
     userPlayer = player;
 }
Esempio n. 7
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Textures.Add("player", Content.Load<Texture2D>(@"images/Hero Sprite Sheet"));
            Textures.Add("inventory", Content.Load<Texture2D>(@"images/Inventory"));
            Textures.Add("sword", Content.Load<Texture2D>(@"images/Sword"));
            Textures.Add("blackKnight", Content.Load<Texture2D>(@"images/Black Knight Sheet"));
            Textures.Add("mario", Content.Load<Texture2D>(@"images/Mario"));
            Textures.Add("tiles", Content.Load<Texture2D>(@"images/Tiles"));
            Textures.Add("dungeonTiles", Content.Load<Texture2D>(@"images/DungeonTiles"));
            Textures.Add("textBox", Content.Load<Texture2D>(@"images/TextBox"));
            Textures.Add("chest", Content.Load<Texture2D>(@"images/Chest"));
            Textures.Add("heartFull", Content.Load<Texture2D>(@"images/Heart Full"));
            Textures.Add("heartHalf",Content.Load<Texture2D>(@"images/Heart Half"));
            Textures.Add("heartEmpty", Content.Load<Texture2D>(@"images/Heart Empty"));

            gameFont = Content.Load<SpriteFont>(@"font\gameFont");

            currentMap = new Dungeon1(spriteBatch, new Rectangle(156, 116, Window.ClientBounds.Width, Window.ClientBounds.Height));

            userPlayer = new Player(Textures["player"], new Vector2(0, 0), Textures["inventory"], gameFont, currentMap);

            currentMap.LoadContent(userPlayer,currentMap);

            //testCharacter = new Enemy(playerTexture, new Vector2(100, 100));
            //basicSword = new Sword("Basic Sword", Textures["sword"], new Vector2(200, 50), ItemType.Weapon);

            //movingElements.Add(userPlayer);

            //movingElements.Add(testCharacter);

            //itemsAvailable.Add(basicSword);
        }