Fire weapons

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-13 20:36:40 +01:00
parent fb2b297900
commit 029e90ea9d
6 changed files with 143 additions and 1 deletions

View File

@@ -0,0 +1,24 @@
import 'package:wolf_dart/features/player/weapon.dart';
class Knife extends Weapon {
Knife()
: super(
name: "Knife",
idleSprite: 416,
fireFrames: [417, 418, 419],
damage: 15,
msPerFrame: 120,
);
@override
bool fire(int currentTime, {required int currentAmmo}) {
// Knife doesn't need ammo!
if (state == WeaponState.idle) {
state = WeaponState.firing;
frameIndex = 0;
lastFrameTime = currentTime;
return true;
}
return false;
}
}

View File

@@ -0,0 +1,12 @@
import 'package:wolf_dart/features/player/weapon.dart';
class MachineGun extends Weapon {
MachineGun()
: super(
name: "Machine Gun",
idleSprite: 413,
fireFrames: [414, 415], // Faster 2-frame loop
damage: 20,
msPerFrame: 80,
);
}

View File

@@ -0,0 +1,11 @@
import 'package:wolf_dart/features/player/weapon.dart';
class Pistol extends Weapon {
Pistol()
: super(
name: "Pistol",
idleSprite: 408,
fireFrames: [409, 410, 411, 412],
damage: 20,
);
}