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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user