mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 22:55:03 -07:00
Bug Fix: Set player positions to snap to integer values to fix pixel distortion.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user