Browse Source

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

main
Colin McMillen 3 months ago
parent
commit
1a025c275b
  1. 4
      Shared/ShmupWorld.cs

4
Shared/ShmupWorld.cs

@ -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;

Loading…
Cancel
Save