Kill kill kill

Signed-off-by: Hans Kokx <hans.d.kokx@gmail.com>
This commit is contained in:
2026-03-13 21:03:34 +01:00
parent d4d5a84bc4
commit 2f66ba451a
4 changed files with 158 additions and 39 deletions

View File

@@ -127,8 +127,19 @@ class Player {
}
}
void updateWeapon(int currentTime) {
/// Returns true only on the specific frame where the hit should be calculated
bool updateWeapon(int currentTime) {
int oldFrame = currentWeapon.frameIndex;
currentWeapon.update(currentTime);
// In your Pistol (Indices 212-215), Index 213 is the flash.
// This translates to frameIndex == 1 in our fireFrames list.
if (currentWeapon.state == WeaponState.firing &&
oldFrame == 0 &&
currentWeapon.frameIndex == 1) {
return true;
}
return false;
}
// Logic to switch weapons (e.g., picking up the Machine Gun)