mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 21:55:03 -07:00
Dumped fractions.
This commit is contained in:
@@ -10,6 +10,8 @@ namespace LunaLightXMG
|
||||
// Declare variables
|
||||
private float hsp; // Horizontal 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
|
||||
public bool grounded; // Is the player grounded?
|
||||
public bool walled; // Is the player wall sliding?
|
||||
@@ -35,6 +37,8 @@ namespace LunaLightXMG
|
||||
// Initialize your variables here
|
||||
hsp = 0;
|
||||
vsp = 0;
|
||||
hsp_frac = 0;
|
||||
vsp_frac = 0;
|
||||
wallJumpDelay = 0;
|
||||
grounded = false;
|
||||
walled = false;
|
||||
@@ -62,7 +66,8 @@ namespace LunaLightXMG
|
||||
{
|
||||
// Update player position
|
||||
Movement(input);
|
||||
|
||||
// Dump fractional position data.
|
||||
DumpFractions();
|
||||
// Update the player's bounding box
|
||||
BoundingBox.Update(position, 8, 16);
|
||||
|
||||
@@ -126,6 +131,17 @@ namespace LunaLightXMG
|
||||
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 ---------------------------------------------------------------
|
||||
private void CollisionChecks(Platform[] platforms)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user