just use WorldBounds.{Width,Height} instead of {Size.X,Size.Y}

This commit is contained in:
Colin McMillen 2021-07-14 11:13:38 -04:00
parent f12d4b1e36
commit 1a025c275b

View File

@ -21,9 +21,9 @@ namespace SemiColinGames {
Vector2 motion = Vector2.Multiply(input[0].Motion, modelTime * speed);
Position = Vector2.Add(Position, motion);
Position.X = Math.Max(Position.X, HalfSize.X);
Position.X = Math.Min(Position.X, worldBounds.Size.X - HalfSize.X);
Position.X = Math.Min(Position.X, worldBounds.Width - HalfSize.X);
Position.Y = Math.Max(Position.Y, HalfSize.Y);
Position.Y = Math.Min(Position.Y, worldBounds.Size.Y - HalfSize.Y);
Position.Y = Math.Min(Position.Y, worldBounds.Height - HalfSize.Y);
// Check whether we need to add new shots.
shotCooldown -= modelTime;