mirror of
https://github.com/TheRavenwoodArts/LunaLightXMG.git
synced 2026-07-30 22:55:03 -07:00
Can toggle game music now.
This commit is contained in:
+8
-11
@@ -12,7 +12,7 @@ namespace LunaLightXMG
|
||||
private float rotation;
|
||||
private Vector2 position;
|
||||
private Rectangle levelBounds;
|
||||
private readonly float camSpeed = 0.1f;
|
||||
private readonly float camSpeed = 5.0f;
|
||||
|
||||
// Screen Shake
|
||||
private float shakeTimeRemaining = 0f;
|
||||
@@ -64,16 +64,13 @@ namespace LunaLightXMG
|
||||
levelBounds = bounds;
|
||||
}
|
||||
|
||||
public void Follow(Vector2 targetPostion)
|
||||
public void Follow(GameTime gameTime, Vector2 targetPostion)
|
||||
{
|
||||
position += (targetPostion - position) * camSpeed;
|
||||
if (Math.Abs(position.X - targetPostion.X) < 0.1f)
|
||||
float smoothSpeed = camSpeed * (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||
position = Vector2.Lerp(position, targetPostion, smoothSpeed);
|
||||
if (Vector2.Distance(position, targetPostion) < 1.0f)
|
||||
{
|
||||
position.X = targetPostion.X;
|
||||
}
|
||||
if (Math.Abs(position.Y - targetPostion.Y) < 0.1f)
|
||||
{
|
||||
position.Y = targetPostion.Y;
|
||||
position = targetPostion;
|
||||
}
|
||||
ClampToBounds();
|
||||
}
|
||||
@@ -91,8 +88,8 @@ namespace LunaLightXMG
|
||||
|
||||
if (shakeTimeRemaining > 0)
|
||||
{
|
||||
float shakeX = util.ChooseFromRange(-shakeMagnitudeCurrent, shakeMagnitudeCurrent);
|
||||
float shakeY = util.ChooseFromRange(-shakeMagnitudeCurrent, shakeMagnitudeCurrent);
|
||||
float shakeX = util.RandomFromRange(-shakeMagnitudeCurrent, shakeMagnitudeCurrent);
|
||||
float shakeY = util.RandomFromRange(-shakeMagnitudeCurrent, shakeMagnitudeCurrent);
|
||||
position.X += shakeX;
|
||||
position.Y += shakeY;
|
||||
shakeTimeRemaining -= (float)gameTime.ElapsedGameTime.TotalSeconds;
|
||||
|
||||
Reference in New Issue
Block a user