Exemple #1
0
        public static void RemoveObj(List <Tuple <int, int> > _ObjectTiles)
        {
            /*List<Objects> _RemoveObjects = new List<Objects>();
             *
             * foreach (Tuple<int,int> y in _ObjectTiles)
             * {
             *  Objects _object = Objects.ObjectList.Find(x => x.Xtile == y.Item1 && x.Ytile == y.Item2);
             *  if (_object != null)
             *  {
             *      _RemoveObjects.Add(_object);
             *  }
             * } */

            /*foreach (var z in _RemoveObjects)
             * {
             *  Objects.ObjectList.Remove(z);
             * }*/

            /*List<SolidTile> _temp = new List<SolidTile>();
             *
             * foreach(var z in _RemoveObjects)
             * {
             *  _temp = SolidTile.AllSolidTiles.FindAll(x => x.Cords.Equals(Tuple.Create(z.Xtile, z.Ytile)));
             *  _temp.ForEach(x => SolidTile.AllSolidTiles.Remove(x));
             * } */

            _ObjectTiles.ForEach(y => Objects.ObjectList.Remove(Objects.ObjectList.Find(x => x.Xtile == y.Item1 && x.Ytile == y.Item2)));
            _ObjectTiles.ForEach(y => SolidTile.AllSolidTiles.Remove(SolidTile.AllSolidTiles.Find(x => x.Cords.Equals(y))));

            Chunck.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
        public void Update()
        {
            this.CenterCordsX += (int)Horizontal_Momentum;
            this.CenterCordsY += (int)Vertical_Momentum;

            this.Hitbox = GetRectangle(this.CenterCordsX, this.CenterCordsY, (int)this.HitboxSize);

            Tuple <int, int> GridCords = Screen.GridCords(this.CenterCordsX, this.CenterCordsY);

            if (XTile != GridCords.Item1 || YTile != GridCords.Item2)
            {
                Console.WriteLine(GridCords);
                PrevTile = Tuple.Create(XTile, YTile);

                this.XTile = GridCords.Item1;
                this.YTile = GridCords.Item2;

                foreach (NPC x in NPC.NPClist)
                {
                    if (x.Follow)
                    {
                        x.Follower();
                    }
                }
            }

            int Cur_Chunck = Chunck.CurrentChunck(this.YTile);

            if (this.chunck != Cur_Chunck)
            {
                this.chunck = Cur_Chunck;
                Chunck.Update();
            }


            EventZone.PlayerIntersection(this.YTile);

            //Screen.CameraMovement(this.CenterCordsX, this.CenterCordsY);

            Horizontal_Momentum = 0;
            Vertical_Momentum   = 0;

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



            foreach (Objects x in SolidTile.LoadedObjects)
            {
                x.Update(this.Hitbox);
            }

            Player1 = this;
        }
Exemple #4
0
 public static void CreateObj(List <int[]> _objects)
 {
     _objects.ForEach(x => Objects.ObjectList.Add(new Objects(x[0], x[1], x[2])));
     Chunck.Update();
 }