mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-31 00:05:02 -07:00
Started work on Player.cs class, converted our OG movement script to C# and implemented as a method in Player class.
This commit is contained in:
@@ -21,10 +21,8 @@ namespace LunaLightXMG
|
||||
Texture2D sprCave1_foreground;
|
||||
Texture2D sprCave1_walls;
|
||||
|
||||
// Test player input and movement with abstracted player input class
|
||||
private PlayerInput playerInput;
|
||||
private Vector2 objectPosition;
|
||||
private float movementSpeed = 100f; // Movement speed in pixels per second
|
||||
// Test player input and movement with abstracted player class
|
||||
private Player player;
|
||||
|
||||
// Native retro scale
|
||||
private int retroWidth = 320;
|
||||
@@ -40,8 +38,8 @@ namespace LunaLightXMG
|
||||
Window.AllowUserResizing = true;
|
||||
IsMouseVisible = true;
|
||||
|
||||
// Test player input and movement with abstracted player input class
|
||||
playerInput = new PlayerInput();
|
||||
// Test player input and movement with abstracted player class
|
||||
player = new Player();
|
||||
}
|
||||
|
||||
private void OnClientSizeChanged(object sender, EventArgs eventArgs)
|
||||
@@ -61,11 +59,8 @@ namespace LunaLightXMG
|
||||
graphics.PreferredBackBufferHeight = 1080;
|
||||
graphics.ApplyChanges();
|
||||
|
||||
// Test player input and movement with abstracted player input class
|
||||
objectPosition = new Vector2(163, 63); // Initial position
|
||||
|
||||
base.Initialize();
|
||||
CalculateRenderDestination(); // Jensen can implement
|
||||
CalculateRenderDestination();
|
||||
}
|
||||
|
||||
private void CalculateRenderDestination()
|
||||
@@ -100,14 +95,8 @@ namespace LunaLightXMG
|
||||
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
|
||||
Exit();
|
||||
|
||||
playerInput.Update();
|
||||
|
||||
// Test player input and movement with abstracted player input class
|
||||
// Update the object's position based on input
|
||||
float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||
objectPosition = playerInput.MoveWithWASD(objectPosition, movementSpeed * deltaTime);
|
||||
|
||||
|
||||
// Test player input and movement with abstracted player class
|
||||
player.Update(gameTime);
|
||||
|
||||
base.Update(gameTime);
|
||||
}
|
||||
@@ -124,8 +113,8 @@ namespace LunaLightXMG
|
||||
// Draw sprites here
|
||||
spriteBatch.Draw(sprCave1_background,new Vector2(0,0),Color.White);
|
||||
|
||||
// Test player input and movement with abstracted player input class
|
||||
spriteBatch.Draw(sprRo, objectPosition, Color.White);
|
||||
// Test player input and movement with abstracted player class
|
||||
player.Draw(spriteBatch, sprRo);
|
||||
|
||||
spriteBatch.Draw(sprCave1_walls, new Vector2(0, 0), Color.White);
|
||||
spriteBatch.Draw(sprCave1_foreground, new Vector2(0, 0), Color.White);
|
||||
|
||||
Reference in New Issue
Block a user