This commit is contained in:
hellka7
2025-05-17 19:41:52 -07:00
parent b4cd4c783b
commit 7146e62d3d
2 changed files with 8 additions and 6 deletions
+5 -3
View File
@@ -105,6 +105,8 @@ namespace LunaLightXMG
player = new Player(initPlayerPosition);
playerInput = new PlayerInput();
playerInput.HasControl = true;
// Misc.
prevKeyState = Keyboard.GetState();
player.LoadContent(Content);
// Init number of platforms / enemies
@@ -126,8 +128,7 @@ namespace LunaLightXMG
// Get utilities
utilities = new Utilities();
// Misc.
prevKeyState = Keyboard.GetState();
}
private void LoadPlatforms()
@@ -162,7 +163,7 @@ namespace LunaLightXMG
ResetGame();
// Update player
playerInput.Update(keyboardState);
playerInput.Update();
player.Update(gameTime, playerInput, platforms);
// Update Enemies
@@ -276,6 +277,7 @@ namespace LunaLightXMG
spriteBatch.DrawString(debugFont, $"Camera Position: {camera2D.Position}", new Vector2(10, 90), Color.White);
spriteBatch.DrawString(debugFont, $"Camera Rotation: {camera2D.Rotation}", new Vector2(10, 110), Color.White);
spriteBatch.DrawString(debugFont, $"Render Target Zoom: {renderHandler.ZoomLevel}", new Vector2(10, 130), Color.White);
spriteBatch.DrawString(debugFont, $"Key Pressed: {Keyboard.GetState().GetPressedKeys()}", new Vector2(10, 150), Color.White);
spriteBatch.DrawString(debugFont, $"Camera Rotation Control - Rotate left: K, Rotate right: L", new Vector2(10, 190), Color.White);
spriteBatch.DrawString(debugFont, $"Render Target Zoom Control - Zoom in: U, Zoom normal: I, Zoom out: O", new Vector2(10, 210), Color.White);
+3 -3
View File
@@ -18,14 +18,14 @@ namespace LunaLightXMG
public bool KeyAttack { get; private set; }
public bool KeyWallClimb { get; private set; }
public void Update(KeyboardState keyboardState)
public void Update()
{
if (HasControl)
{
if (Controller)
{
// If using controller, switch to keyboard by pressing any key
if (keyboardState.GetPressedKeys().Length > 0)
if (Keyboard.GetState().GetPressedKeys().Length > 0)
{
// TODO: Insert logic to create the objMouseJoyStick instance
Controller = false;
@@ -72,7 +72,7 @@ namespace LunaLightXMG
}
// Keyboard input
//KeyboardState keyboardState = Keyboard.GetState();
KeyboardState keyboardState = Keyboard.GetState();
KeyLeft = keyboardState.IsKeyDown(Keys.A) ? 1 : 0;
KeyRight = keyboardState.IsKeyDown(Keys.D) ? 1 : 0;