Fixed pistol and knife sprites for retail. Added firing mechanism.

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-13 20:53:00 +01:00
parent 029e90ea9d
commit d4d5a84bc4
7 changed files with 83 additions and 20 deletions

View File

@@ -16,16 +16,13 @@ abstract class Weapon {
required this.idleSprite,
required this.fireFrames,
required this.damage,
this.msPerFrame = 100, // Speed of animation
this.msPerFrame = 100,
});
int get currentSprite =>
state == WeaponState.idle ? idleSprite : fireFrames[frameIndex];
bool get isFiring => state == WeaponState.firing;
/// The main entry point for the player to use the gun.
/// Returns true if a bullet was actually spent.
/// Core firing logic. Returns true if a bullet was spent.
bool fire(int currentTime, {required int currentAmmo}) {
if (state == WeaponState.idle && currentAmmo > 0) {
state = WeaponState.firing;