mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 22:55:03 -07:00
Dumped fractions.
This commit is contained in:
@@ -10,6 +10,8 @@ namespace LunaLightXMG
|
|||||||
// Declare variables
|
// Declare variables
|
||||||
private float hsp; // Horizontal speed
|
private float hsp; // Horizontal speed
|
||||||
public float vsp; // Vertical speed
|
public float vsp; // Vertical speed
|
||||||
|
private float hsp_frac; // Hold fractional position data
|
||||||
|
private float vsp_frac; // Hold fractional position data
|
||||||
private float wallJumpDelay; // Delay for wall jumping
|
private float wallJumpDelay; // Delay for wall jumping
|
||||||
public bool grounded; // Is the player grounded?
|
public bool grounded; // Is the player grounded?
|
||||||
public bool walled; // Is the player wall sliding?
|
public bool walled; // Is the player wall sliding?
|
||||||
@@ -35,6 +37,8 @@ namespace LunaLightXMG
|
|||||||
// Initialize your variables here
|
// Initialize your variables here
|
||||||
hsp = 0;
|
hsp = 0;
|
||||||
vsp = 0;
|
vsp = 0;
|
||||||
|
hsp_frac = 0;
|
||||||
|
vsp_frac = 0;
|
||||||
wallJumpDelay = 0;
|
wallJumpDelay = 0;
|
||||||
grounded = false;
|
grounded = false;
|
||||||
walled = false;
|
walled = false;
|
||||||
@@ -62,7 +66,8 @@ namespace LunaLightXMG
|
|||||||
{
|
{
|
||||||
// Update player position
|
// Update player position
|
||||||
Movement(input);
|
Movement(input);
|
||||||
|
// Dump fractional position data.
|
||||||
|
DumpFractions();
|
||||||
// Update the player's bounding box
|
// Update the player's bounding box
|
||||||
BoundingBox.Update(position, 8, 16);
|
BoundingBox.Update(position, 8, 16);
|
||||||
|
|
||||||
@@ -126,6 +131,17 @@ namespace LunaLightXMG
|
|||||||
return start;
|
return start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void DumpFractions()
|
||||||
|
{
|
||||||
|
// Movement Speeds
|
||||||
|
hsp += hsp_frac;
|
||||||
|
vsp += vsp_frac;
|
||||||
|
hsp_frac = hsp - (float)Math.Floor(hsp);
|
||||||
|
vsp_frac = vsp - (float)Math.Floor(vsp);
|
||||||
|
hsp -= hsp_frac;
|
||||||
|
vsp -= vsp_frac;
|
||||||
|
}
|
||||||
|
|
||||||
// Collision Checks - maybe abstract to a class ---------------------------------------------------------------
|
// Collision Checks - maybe abstract to a class ---------------------------------------------------------------
|
||||||
private void CollisionChecks(Platform[] platforms)
|
private void CollisionChecks(Platform[] platforms)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user