Exemple #1
0
        public NPC(int Xtile, int Ytile, string Name, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent)
        {
            this.Xtile = Xtile;
            this.Ytile = Ytile;

            this.prologueContent = prologueContent;
            this.Name            = Name;
            GetNPCData(this.Name);

            this.FrontSpriteBatch = FrontSpriteBatch;

            this.Tilelist = Map.Tilelist; // HAAL DIT NOG WEG?

            this.Width  = NPCimg.Width * this.scale;
            this.Height = NPCimg.Height * this.scale;

            this.CenterCordsX = (int)(this.Xtile * Screen.GridSize + Screen.GridSize / 2);
            this.CenterCordsY = (int)(this.Ytile * Screen.GridSize + Screen.GridSize / 2);

            this.HitboxSize        = this.Width / 2;
            this.HitboxWidthMargin = (this.Width - this.HitboxSize) / 2;
            this.HitboxHalf        = this.HitboxSize / 2;

            NPClist.Add(this);

            Update();
        }
Exemple #2
0
        public Player(int _Xtile, int _Ytile, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent, List <Tiles> Tilelist)
        {
            LoadJson();

            this.XTile = _Xtile;
            this.YTile = _Ytile;

            imgPlayer   = prologueContent.imgPlayer;
            this.Width  = 16 * this.Scale;
            this.Height = 30 * this.Scale;

            this.CenterCordsX = (int)(this.XTile * Screen.GridSize + Screen.GridSize / 2);
            this.CenterCordsY = (int)(this.YTile * Screen.GridSize + Screen.GridSize / 2);

            this.chunck = 0;



            this.FrontSpriteBatch = FrontSpriteBatch;
            this.Tilelist         = Map.Tilelist;

            this.HitboxSize        = this.Width / 2;
            this.HitboxWidthMargin = (this.Width - this.HitboxSize) / 2;
            this.HitboxHalf        = this.HitboxSize / 2;

            this.ImageCordsX = (int)(this.CenterCordsX - this.Width / 2);
            this.ImageCordsY = (int)(this.CenterCordsY + (this.HitboxHalf) - this.Height);

            Player1 = this;
            Chunck.Update();
            Update();
        }
Exemple #3
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);
            FrontSpriteBatch = new SpriteBatch(GraphicsDevice);

            prologueContent = new PrologueContent(Content);

            //Some general Setup information

            Screen.ScreenWidth  = GraphicsDevice.Viewport.Width;
            Screen.ScreenHeight = GraphicsDevice.Viewport.Height;

            Screen.GridSize = Screen.ScreenWidth / Screen.MinGridX;

            map1   = new Map(prologueContent, spriteBatch);
            player = new Player(350, 180, FrontSpriteBatch, prologueContent, map1.Tilelist);
            npc1   = new NPC(3, 5, FrontSpriteBatch, prologueContent, map1.Tilelist);

            Vector2 Location = new Vector2(100, 100);

            textbox1 = new InformationTextBox(Location, "HALLO HOE GAAT ET ERMEE@ Persoonlijk gaat het wel redelijk met mij, de bedoeling van deze zin is is dat ie tering lang word zodat hij gesplit moet worden@ Maar.. Maar@ Ohhnee@stut@stut@stutterrr@Jahoor@volgende pagina aub dankuwel@", 600, 150, FrontSpriteBatch, prologueContent);
            textbox1.SplitInLines();

            TestObject = new Objects(5, 5, "KEK", FrontSpriteBatch, prologueContent);



            // TODO: use this.Content to load your game content here
        }
Exemple #4
0
        public Map(PrologueContent prologueContent, SpriteBatch spriteBatch)
        {
            MapWidth  = 32;
            MapHeight = 18;

            //It loops through the Array, placing Tiles where need be.

            for (int y = 0; y < MapHeight; y++)
            {
                for (int x = 0; x < MapWidth; x++)
                {
                    Tuple <float, float> Coords = Screen.ScreenCords(x, y);
                    switch (Grid[y, x])
                    {
                    case 0:
                        break;

                    case 1:
                        Tilelist.Add(new Tiles(x, y, 1, true, Coords.Item1, Coords.Item2, prologueContent.Tile1, spriteBatch));
                        break;

                    case 2:
                        Tilelist.Add(new Tiles(x, y, 2, false, Coords.Item1, Coords.Item2, prologueContent.Tile2, spriteBatch));
                        break;
                    }
                }
            }
        }
Exemple #5
0
        public NPC(int Xtile, int Ytile, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent, List <Tiles> Tilelist)
        {
            this.Xtile = Xtile;
            this.Ytile = Ytile;

            NPCimg                   = prologueContent.imgPlayer;
            this.width               = NPCimg.Width;
            this.height              = NPCimg.Height;
            this.FrontSpriteBatch    = FrontSpriteBatch;
            this.scale               = 5;
            this.Vertical_Momentum   = 0;
            this.Horizontal_Momentum = 0;
            this.Moving              = false;
            this.Tilelist            = Tilelist;
            this.prologueContent     = prologueContent;

            this.Width  = this.width * this.scale;
            this.Height = this.height * this.scale;

            this.HitboxWidthMargin = (this.Width - Screen.GridSize) / 2;

            this.HitboxHeight = Screen.GridSize - 30;
            this.HitboxWidth  = this.Width - (this.HitboxWidthMargin * 2);
            Hitbox            = new Rectangle((int)(this.X + this.HitboxWidthMargin), (int)(this.Y + this.Height - this.HitboxHeight), (int)this.HitboxWidth, (int)this.HitboxHeight);

            NPClist.Add(this);

            this.Xnormalized = Xtile * Screen.GridSize;
            this.Ynormalized = Ytile * Screen.GridSize + Screen.GridSize - 1;

            this.X = this.Xnormalized + Screen.GridSize / 2 - this.Width / 2;
            this.Y = Ytile * Screen.GridSize - this.Height + Screen.GridSize / 2;
        }
Exemple #6
0
        public Tiles(int X, int Y, int ID, float Xcord, float Ycord, Texture2D tileimage, SpriteBatch spriteBatch, PrologueContent prologueContent)
        {
            this.prologueContent = prologueContent;

            GetTileData(ID);

            this.X = X;
            this.Y = Y;

            this.chunck = Chunck.CurrentChunck(this.Y);

            this.Xcord       = Xcord;
            this.Ycord       = Ycord;
            this.spriteBatch = spriteBatch;

            this.TileCords = Tuple.Create(X, Y);

            if (this.Solid == true)
            {
                SolidTile.AllSolidTiles.Add(new SolidTile(this.TileCords, this.chunck));
            }
        }
Exemple #7
0
        public Map(PrologueContent prologueContent, SpriteBatch spriteBatch)
        {
            var levelData = LoadLevelData("C:/Users/david/source/repos/Prologue/Prologue/Map.Json");

            int[,] Grid = levelData;

            foreach (int EventID in EventZones)
            {
                EventZone.EventZoneList.Add(new EventZone(EventID));
            }


            Objects.ObjectList.Add(new Objects(7, 7, 1));
            Objects.ObjectList.Add(new Objects(3, 6, 1));
            Objects.ObjectList.Add(new Objects(4, 8, 1));
            Objects.ObjectList.Add(new Objects(3, 10, 1));
            Objects.ObjectList.Add(new Objects(19, 9, 1));
            Objects.ObjectList.Add(new Objects(20, 9, 1));
            Objects.ObjectList.Add(new Objects(21, 9, 1));
            Objects.ObjectList.Add(new Objects(19, 12, 2));


            MapWidth  = Grid.GetLength(1);
            MapHeight = Grid.GetLength(0);

            for (int y = 0; y < MapHeight; y++)
            {
                for (int x = 0; x < MapWidth; x++)
                {
                    Tuple <int, int> Coords = Screen.ScreenCords(x, y); // This will all be replaced once Tiles Have been Json-Fied
                    if (Grid[y, x] != 0)
                    {
                        Tilelist.Add(new Tiles(x, y, Grid[y, x], Coords.Item1, Coords.Item2, prologueContent.Tile1, spriteBatch, prologueContent));
                    }
                }
            }
        }
Exemple #8
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);
            FrontSpriteBatch = new SpriteBatch(GraphicsDevice);

            prologueContent = new PrologueContent(Content);

            //Some general Setup information
            Camera.InitializeCamera(new Vector2(0, 0), true);

            Screen.ScreenWidth  = GraphicsDevice.Viewport.Width;
            Screen.ScreenHeight = GraphicsDevice.Viewport.Height;

            Screen.GridSize = Screen.ScreenWidth / Screen.MinGridX;

            SpriteSheet.LoadedSpriteSheets.Add(new SpriteSheet("Test_Animation_SpriteSheet"));
            SpriteSheet.LoadedSpriteSheets.Add(new SpriteSheet("Textbox_SpriteSheet"));
            SpriteSheet.LoadedSpriteSheets.Add(new SpriteSheet("Player_Walk_SpriteSheet"));


            map1   = new Map(prologueContent, spriteBatch);
            player = new Player(20, 17, FrontSpriteBatch, prologueContent, Map.Tilelist);
            Console.WriteLine("Items Initialized!");
            npc1 = new NPC(21, 19, "Mathijs", FrontSpriteBatch, prologueContent);

            Textbox.LoadTextBoxData();

            Vector2 Location = new Vector2(100, 100);
            //Textbox.TextBoxes.Add(new InformationTextBox( "HALLO HOE GAAT ET ERMEE@ Persoonlijk gaat het wel redelijk met mij, de bedoeling van deze zin is is dat ie tering lang word zodat hij gesplit moet worden@ Maar.. Maar@ Ohhnee@stut@stut@stutterrr@Jahoor@volgende pagina aub dankuwel@", 600, 150, FrontSpriteBatch, prologueContent));

            //TestObject = new Objects(7, 7, 1, FrontSpriteBatch, prologueContent);



            // TODO: use this.Content to load your game content here
        }
Exemple #9
0
        public Player(float X, float Y, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent, List <Tiles> Tilelist)
        {
            this.X                   = X;
            this.Y                   = Y;
            this.Frozen              = false;
            imgPlayer                = prologueContent.imgPlayer;
            this.width               = imgPlayer.Width;
            this.height              = imgPlayer.Height;
            this.FrontSpriteBatch    = FrontSpriteBatch;
            this.scale               = 5;
            this.Vertical_Momentum   = 0;
            this.Horizontal_Momentum = 0;
            this.Tilelist            = Tilelist;
            this.prologueContent     = prologueContent;

            this.Width  = this.width * this.scale;
            this.Height = this.height * this.scale;

            this.HitboxWidthMargin = (this.Width - Screen.GridSize) / 2 + 10;
            this.HitboxHeight      = Screen.GridSize + 20;

            this.HitboxHeight2 = Screen.GridSize - 30;
            this.HitboxWidth   = this.Width - (this.HitboxWidthMargin * 2);
        }
Exemple #10
0
        public Textbox(Vector2 Location, String FullText, int SizeX, int SizeY, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent)
        {
            //this.Location = Location;
            this.FullText = FullText;

            this.SizeX = SizeX;
            this.SizeY = SizeY;

            this.Location = new Vector2(Screen.ScreenWidth / 2 - this.SizeX / 2, Screen.ScreenHeight / 2 + 130);

            this.prologueContent  = prologueContent;
            this.FrontSpriteBatch = FrontSpriteBatch;
            this.TextBoximg       = prologueContent.Tile1;

            LinesOnscreen = new List <string> {
                "", "", "", ""
            };
            this.OnPage   = 0;
            this.OnLine   = 0;
            this.OnLetter = 0;
            this.SkipText = false;
            this.Continue = true;
            this.Finish   = false;
            Hitbox        = new Rectangle((int)this.Location.X, (int)this.Location.Y, this.SizeX, this.SizeY);

            _Timer = 0;
        }
Exemple #11
0
 public InformationTextBox(Vector2 Location, String FullText, int SizeX, int SizeY, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent) : base(Location, FullText, SizeX, SizeY, FrontSpriteBatch, prologueContent)
 {
 }
Exemple #12
0
        //------------------------------------------------------------

        public Objects(int _Xtile, int _Ytile, string _Information, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent)
        {
            this.Xtile = _Xtile;
            this.Ytile = _Ytile;

            this.Information = _Information;

            this.prologueContent  = prologueContent;
            this.FrontSpriteBatch = FrontSpriteBatch;

            this.Objectimg = prologueContent.Tile1;


            Tuple <float, float> _Screencords = Screen.ScreenCords(this.Xtile, this.Ytile);

            this.Xcord = _Screencords.Item1;
            this.Ycord = _Screencords.Item2;
            this.Solid = true;

            ObjectList.Add(this);
        }
Exemple #13
0
 public NormalObject(int _Xtile, int _Ytile, string _Text, SpriteBatch FrontSpriteBatch, PrologueContent prologueContent) : base(_Xtile, _Ytile, _Text, FrontSpriteBatch, prologueContent)
 {
 }