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; }
public static void PlayerIntersection(int _PlayerYtile) { EventZone Event = EventZoneList.Find(x => x.YPosition == _PlayerYtile); if (Event != null) { Player.Horizontal_Momentum = 0; Player.Vertical_Momentum = 0; Event.TriggerEventZone(); } }
private void DeleteEventZone() { int _EventZoneID = (int)this.CurrentAction["EventZone"]; EventZone.DeleteEventZone(_EventZoneID); }