mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 22:55:03 -07:00
Minor update.
This commit is contained in:
@@ -8,6 +8,7 @@ namespace LunaLightXMG
|
||||
public class Enemy
|
||||
{
|
||||
private float hsp; // Horizontal speed
|
||||
private float hspPrev;
|
||||
private float vsp; // Vertical speed
|
||||
private float hsp_frac; // Horizontal fractional speed
|
||||
private float vsp_frac; // Vertical fractional speed
|
||||
@@ -52,13 +53,20 @@ namespace LunaLightXMG
|
||||
|
||||
public void Draw(SpriteBatch spriteBatch)
|
||||
{
|
||||
spriteBatch.Draw(texture, position, Color.White);
|
||||
if (hsp <= 1 && hsp >= -1)
|
||||
{
|
||||
spriteBatch.Draw(texture, position, Color.White);
|
||||
}
|
||||
else
|
||||
{
|
||||
spriteBatch.Draw(texture, position, Color.Red);
|
||||
}
|
||||
}
|
||||
|
||||
// Method Implementation -------------------------------------------------------------------------------
|
||||
private void Movement()
|
||||
{
|
||||
if (hsp == 0) { hsp = 1; }
|
||||
if (hsp == 0) { hsp = hspPrev; }
|
||||
if (walled) { hsp = -hsp; }
|
||||
if (!grounded) { vsp += grv; }
|
||||
if (RandomJump() && grounded) { vsp = vspJump; }
|
||||
@@ -66,6 +74,8 @@ namespace LunaLightXMG
|
||||
|
||||
private void CollisionChecks(Platform[] platforms, Player player)
|
||||
{
|
||||
// Remember hsp
|
||||
hspPrev = hsp;
|
||||
// Horizontal collision prediction
|
||||
float onePixh = Math.Sign(hsp);
|
||||
if (collisionManager.IsColliding(position + new Vector2(hsp, 0), boundingBox, platforms))
|
||||
|
||||
Reference in New Issue
Block a user