diff --git a/Game1.cs b/Game1.cs index c23dbe7..c8b3576 100644 --- a/Game1.cs +++ b/Game1.cs @@ -61,7 +61,7 @@ namespace LunaLightXMG graphics.PreferredBackBufferHeight = 1080; graphics.ApplyChanges(); - playerInput.HasControl = true; // Do we need this here? + playerInput.HasControl = true; // May need to find a new home for this base.Initialize(); CalculateRenderDestination(); @@ -71,10 +71,15 @@ namespace LunaLightXMG { Point size = GraphicsDevice.Viewport.Bounds.Size; - float scaleX = (float)size.X / renderTarget.Width; - float scaleY = (float)size.Y / renderTarget.Height; - float scale = Math.Min(scaleX, scaleY); + // Calculate the integer scale factor + int scaleX = size.X / renderTarget.Width; + int scaleY = size.Y / renderTarget.Height; + int scale = Math.Min(scaleX, scaleY); + // Ensure the scale is at least 1 + scale = Math.Max(scale, 1); + + // Set renderDestination renderDestination.Width = (int)(renderTarget.Width * scale); renderDestination.Height = (int)(renderTarget.Height * scale); diff --git a/Player.cs b/Player.cs index 7d18c4b..ac2f26d 100644 --- a/Player.cs +++ b/Player.cs @@ -23,7 +23,7 @@ namespace LunaLightXMG private float vspJump; // Jump speed // Player position - public Vector2 Position; + public Vector2 position; // Constructor to initialize variables public Player() @@ -45,7 +45,7 @@ namespace LunaLightXMG vspMaxWall = 5f; vspJump = -10f; - Position = new Vector2(163, 63); // Initialize player position + position = new Vector2(163, 63); // Initialize player position } // Update method to handle movement logic @@ -54,8 +54,8 @@ namespace LunaLightXMG Movement(input); // Update player position based on speed - Position.X += hsp; - Position.Y += vsp; + position.X += hsp; + position.Y += vsp; } private void Movement(PlayerInput input) @@ -111,7 +111,9 @@ namespace LunaLightXMG public void Draw(SpriteBatch spriteBatch, Texture2D texture) { - spriteBatch.Draw(texture, Position, Color.White); + // Snap position to integer values + Vector2 drawPosition = new Vector2((int)position.X, (int)position.Y); + spriteBatch.Draw(texture, drawPosition, Color.White); } }