Add project files.

This commit is contained in:
2025-12-16 08:51:34 -05:00
parent ed4d50a5bd
commit f7e3fe0a47
140 changed files with 2946 additions and 0 deletions

View File

@@ -0,0 +1,44 @@
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
namespace AlienAttack.MonoGame.Things;
internal class Explosion(int x, int y, float xVel, float yVel) : Sprite(x, y)
{
protected int CurrentFrame { get; private set; } = 1;
protected int MaxFrames => 9;
protected int AnimationThreshold => 3; //5;
protected int CurrentThreshold { get; private set; } = 5;
public override void Draw(SpriteDrawArgs args)
{
Texture2D texture = args.Content.Load<Texture2D>(@$"Sprites\Explosion01_Frame_0{CurrentFrame}_png_processed");
args.SpriteBatch.Draw(texture, Position, null, DrawColor, 0, new Vector2(0, 0), 1f, SpriteEffects.None, 1);
base.Draw(args);
}
public override void Update(SpriteUpdateContext context)
{
base.Update(context);
XPosition += xVel;
YPosition += yVel;
if (CurrentThreshold > 0)
{
CurrentThreshold--;
}
else
{
if (CurrentFrame == MaxFrames)
{
IsDead = true;
return;
}
CurrentFrame++;
CurrentThreshold = AnimationThreshold;
}
}
}