//pu.Location().X - width public DescriptionScreen(PickUpScreen pu, BaseItem bi, int width, int height, bool bRight = false) : base(new Microsoft.Xna.Framework.Rectangle(pu.Location().X - width, pu.Location().Y, width, height)) { this.pu = pu; this.bi = bi; var temp = this.pu.Location(); this.bRight = bRight; if (Location().X < 0) { ChangeLocation(new Rectangle(pu.Location().X + pu.Location().Width, pu.Location().Y, Location().Width, Location().Height)); bRight = true; } frameBox = new Rectangle(0, 0, Location().Width, Location().Height); textBox = new Rectangle(0 + 5, 0 + 5, Location().Width - 10, Location().Height - 10); }
public override void Update(GameTime gt) { if (!bRight) { if (Location().X < 0) { bRight = true; ChangeLocation(new Rectangle(pu.Location().X + pu.Location().Width, pu.Location().Y, Location().Width, Location().Height)); } } else { if (Location().X + Location().Width > 1366) { bRight = false; ChangeLocation(new Rectangle(pu.Location().X - Location().Width, pu.Location().Y, Location().Width, Location().Height)); } } }