mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 22:55:03 -07:00
Renamed all snake_case variables to use camelCase.
This commit is contained in:
@@ -17,9 +17,9 @@ namespace LunaLightXMG
|
|||||||
|
|
||||||
// Test sprites
|
// Test sprites
|
||||||
Texture2D sprRo;
|
Texture2D sprRo;
|
||||||
Texture2D sprCave1_background;
|
Texture2D sprCave1Background;
|
||||||
Texture2D sprCave1_foreground;
|
Texture2D sprCave1Foreground;
|
||||||
Texture2D sprCave1_walls;
|
Texture2D sprCave1Walls;
|
||||||
|
|
||||||
// Test player input and movement with abstracted player class
|
// Test player input and movement with abstracted player class
|
||||||
private Player player;
|
private Player player;
|
||||||
@@ -36,7 +36,7 @@ namespace LunaLightXMG
|
|||||||
|
|
||||||
Window.ClientSizeChanged += OnClientSizeChanged;
|
Window.ClientSizeChanged += OnClientSizeChanged;
|
||||||
Window.AllowUserResizing = true;
|
Window.AllowUserResizing = true;
|
||||||
IsMouseVisible = true;
|
IsMouseVisible = true;
|
||||||
|
|
||||||
// Test player input and movement with abstracted player class
|
// Test player input and movement with abstracted player class
|
||||||
player = new Player();
|
player = new Player();
|
||||||
@@ -81,9 +81,9 @@ namespace LunaLightXMG
|
|||||||
{
|
{
|
||||||
spriteBatch = new SpriteBatch(GraphicsDevice);
|
spriteBatch = new SpriteBatch(GraphicsDevice);
|
||||||
sprRo = Content.Load<Texture2D>("sprRo_Wall");
|
sprRo = Content.Load<Texture2D>("sprRo_Wall");
|
||||||
sprCave1_background = Content.Load<Texture2D>("spr_cave1_background");
|
sprCave1Background = Content.Load<Texture2D>("spr_cave1_background");
|
||||||
sprCave1_foreground = Content.Load<Texture2D>("spr_Cave1_foreground");
|
sprCave1Foreground = Content.Load<Texture2D>("spr_Cave1_foreground");
|
||||||
sprCave1_walls = Content.Load<Texture2D>("spr_Cave1_walls");
|
sprCave1Walls = Content.Load<Texture2D>("spr_Cave1_walls");
|
||||||
|
|
||||||
// Test Render Target
|
// Test Render Target
|
||||||
renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight);
|
renderTarget = new RenderTarget2D(GraphicsDevice, retroWidth, retroHeight);
|
||||||
@@ -111,13 +111,13 @@ namespace LunaLightXMG
|
|||||||
// Test Sprite
|
// Test Sprite
|
||||||
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
|
spriteBatch.Begin(samplerState: SamplerState.PointClamp);
|
||||||
// Draw sprites here
|
// Draw sprites here
|
||||||
spriteBatch.Draw(sprCave1_background,new Vector2(0,0),Color.White);
|
spriteBatch.Draw(sprCave1Background,new Vector2(0,0),Color.White);
|
||||||
|
|
||||||
// Test player input and movement with abstracted player class
|
// Test player input and movement with abstracted player class
|
||||||
player.Draw(spriteBatch, sprRo);
|
player.Draw(spriteBatch, sprRo);
|
||||||
|
|
||||||
spriteBatch.Draw(sprCave1_walls, new Vector2(0, 0), Color.White);
|
spriteBatch.Draw(sprCave1Walls, new Vector2(0, 0), Color.White);
|
||||||
spriteBatch.Draw(sprCave1_foreground, new Vector2(0, 0), Color.White);
|
spriteBatch.Draw(sprCave1Foreground, new Vector2(0, 0), Color.White);
|
||||||
spriteBatch.End();
|
spriteBatch.End();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -13,22 +13,22 @@ namespace LunaLightXMG
|
|||||||
private float wallJumpDelay; // Delay for wall jumping
|
private float wallJumpDelay; // Delay for wall jumping
|
||||||
private bool grounded; // Is the player grounded?
|
private bool grounded; // Is the player grounded?
|
||||||
private bool walled; // Is the player wall sliding?
|
private bool walled; // Is the player wall sliding?
|
||||||
private float hsp_acc; // Horizontal acceleration
|
private float hspAcc; // Horizontal acceleration
|
||||||
private float hsp_friction_ground; // Ground friction
|
private float hspFrictionGround; // Ground friction
|
||||||
private float hsp_friction_air; // Air friction
|
private float hspFrictionAir; // Air friction
|
||||||
private float hsp_walk; // Maximum horizontal speed
|
private float hspWalk; // Maximum horizontal speed
|
||||||
private float grv; // Gravity
|
private float grv; // Gravity
|
||||||
private float vsp_max; // Maximum vertical speed
|
private float vspMax; // Maximum vertical speed
|
||||||
private float grv_wall; // Gravity when wall sliding
|
private float grvWall; // Gravity when wall sliding
|
||||||
private float vsp_max_wall; // Maximum vertical speed when wall sliding
|
private float vspMaxWall; // Maximum vertical speed when wall sliding
|
||||||
private float vsp_jump; // Jump speed
|
private float vspJump; // Jump speed
|
||||||
|
|
||||||
// Player position
|
// Player position
|
||||||
public Vector2 Position;
|
public Vector2 Position;
|
||||||
|
|
||||||
// Placeholder for key input states
|
// Placeholder for key input states
|
||||||
private bool key_left;
|
private bool keyLeft;
|
||||||
private bool key_right;
|
private bool keyRight;
|
||||||
|
|
||||||
// Constructor to initialize variables
|
// Constructor to initialize variables
|
||||||
public Player()
|
public Player()
|
||||||
@@ -39,16 +39,16 @@ namespace LunaLightXMG
|
|||||||
wallJumpDelay = 0;
|
wallJumpDelay = 0;
|
||||||
grounded = false;
|
grounded = false;
|
||||||
walled = false;
|
walled = false;
|
||||||
hsp_acc = 0.5f;
|
hspAcc = 0.5f;
|
||||||
hsp_friction_ground = 0.2f;
|
hspFrictionGround = 0.2f;
|
||||||
hsp_friction_air = 0.1f;
|
hspFrictionAir = 0.1f;
|
||||||
hsp_walk = 4f;
|
hspWalk = 4f;
|
||||||
//grv = 0.5f;
|
//grv = 0.5f;
|
||||||
grv = 0.0f; // No grav until we have walls, bounding boxes, etc..
|
grv = 0.0f; // No grav until we have walls, bounding boxes, etc..
|
||||||
vsp_max = 10f;
|
vspMax = 10f;
|
||||||
grv_wall = 0.1f;
|
grvWall = 0.1f;
|
||||||
vsp_max_wall = 5f;
|
vspMaxWall = 5f;
|
||||||
vsp_jump = -10f;
|
vspJump = -10f;
|
||||||
|
|
||||||
Position = new Vector2(163, 63); // Initialize player position
|
Position = new Vector2(163, 63); // Initialize player position
|
||||||
}
|
}
|
||||||
@@ -71,30 +71,30 @@ namespace LunaLightXMG
|
|||||||
|
|
||||||
if (wallJumpDelay == 0) // no left-right control until delay is 0, prevents rapid wall climb
|
if (wallJumpDelay == 0) // no left-right control until delay is 0, prevents rapid wall climb
|
||||||
{
|
{
|
||||||
float move_h = (key_right ? 1 : 0) - (key_left ? 1 : 0);
|
float moveH = (keyRight ? 1 : 0) - (keyLeft ? 1 : 0);
|
||||||
hsp += move_h * hsp_acc;
|
hsp += moveH * hspAcc;
|
||||||
|
|
||||||
if (move_h == 0)
|
if (moveH == 0)
|
||||||
{
|
{
|
||||||
float hsp_friction_final = grounded ? hsp_friction_ground : hsp_friction_air;
|
float hspFrictionFinal = grounded ? hspFrictionGround : hspFrictionAir;
|
||||||
hsp = Approach(hsp, 0, hsp_friction_final);
|
hsp = Approach(hsp, 0, hspFrictionFinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
hsp = MathHelper.Clamp(hsp, -hsp_walk, hsp_walk);
|
hsp = MathHelper.Clamp(hsp, -hspWalk, hspWalk);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate vertical movement
|
// Calculate vertical movement
|
||||||
float grv_final = grv;
|
float grvFinal = grv;
|
||||||
float vsp_max_final = vsp_max;
|
float vspMaxFinal = vspMax;
|
||||||
|
|
||||||
if (walled && vsp > 0)
|
if (walled && vsp > 0)
|
||||||
{
|
{
|
||||||
grv_final = grv_wall;
|
grvFinal = grvWall;
|
||||||
vsp_max_final = vsp_max_wall;
|
vspMaxFinal = vspMaxWall;
|
||||||
}
|
}
|
||||||
|
|
||||||
vsp += (vsp == 0 ? grv_final * 2 : grv_final);
|
vsp += (vsp == 0 ? grvFinal * 2 : grvFinal);
|
||||||
vsp = MathHelper.Clamp(vsp, vsp_jump, vsp_max_final);
|
vsp = MathHelper.Clamp(vsp, vspJump, vspMaxFinal);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper method to smoothly approach a target value
|
// Helper method to smoothly approach a target value
|
||||||
@@ -119,8 +119,8 @@ namespace LunaLightXMG
|
|||||||
private void HandleInput()
|
private void HandleInput()
|
||||||
{
|
{
|
||||||
KeyboardState keyboardState = Keyboard.GetState();
|
KeyboardState keyboardState = Keyboard.GetState();
|
||||||
key_left = keyboardState.IsKeyDown(Keys.A);
|
keyLeft = keyboardState.IsKeyDown(Keys.A);
|
||||||
key_right = keyboardState.IsKeyDown(Keys.D);
|
keyRight = keyboardState.IsKeyDown(Keys.D);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(SpriteBatch spriteBatch, Texture2D texture)
|
public void Draw(SpriteBatch spriteBatch, Texture2D texture)
|
||||||
|
|||||||
Reference in New Issue
Block a user